Git Product home page Git Product logo

Comments (8)

laraform avatar laraform commented on May 24, 2024 1

Ok so the problem is that the compiled .js file in dist already includes Trix and it conflicts with the Trix library that we import in the theme. A quick workaround is to import @laraform/laraform/src instead of @larafom/laraform until the fix is released.

from laraform.

grantholle avatar grantholle commented on May 24, 2024

Extending essentials, like the default theme does, seems to work ok.

import defaultTheme from '@laraform/laraform/src/themes/default/essentials'

export default utils.extendTheme(defaultTheme, {
...

from laraform.

laraform avatar laraform commented on May 24, 2024

It seems like you are including trix multiple times:

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "trix-toolbar" has already been used with this registry

The reason why essentials does not throw error is because Trix is not among essential elements.

I'd recommend double checking that you are not including Trix anywhere else in your project.

from laraform.

tanthammar avatar tanthammar commented on May 24, 2024

I have the same problem.
There is something with the extending the theme that loads trix twice.
If I remove the custom theme I get no errors.

resources/laraform/theme/index.js

import extendTheme from '@laraform/laraform/src/utils'
import defaultTheme from '@laraform/laraform/src/themes/default'

import TextElement from './components/elements/TextElement.vue'

export default extendTheme(defaultTheme, {
  classes: {},
    elements: {
      TextElement
  },
  components: {},
  layouts: {},
  grid: {},
})

app.js

import Vue from 'vue'

import Laraform from '@laraform/laraform' // <- Premimum package
import QuasarTheme from '../laraform/theme'

Laraform.theme('quasar-theme', QuasarTheme)

Laraform.config({
  theme: 'quasar-theme',
  endpoints: {
    process: '/laraform/process',
    // Only required for full version
    elements: {
      trix: {
        attachment: '/laraform/trix-attachment'
      }
    },
    validators: {
      active_url: '/laraform/validator/active_url',
      exists: '/laraform/validator/exists',
      unique: '/laraform/validator/unique',
    },
  }
})

Vue.use(Laraform)

TextElement.vue

<template>
  <div class="my-text-element">
    <label
      :for="name"
    >{{ label }}</label>

    <input
      v-model="model"
      :type="inputType"
    />
  </div>
</template>

<script>
  import TextElement from '@laraform/laraform/src/components/elements/TextElement'

  export default {
    mixins: [TextElement]
  }
</script>

Error:

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name "trix-toolbar" has already been used with this registry

from laraform.

grantholle avatar grantholle commented on May 24, 2024

I'm not including Trix anywhere or using it anywhere.

from laraform.

tanthammar avatar tanthammar commented on May 24, 2024

Me neither.

from laraform.

mike2410 avatar mike2410 commented on May 24, 2024

Importing src seems to work.
Note that you had a typo there @Laraform/laraform/src that just tripped me up ;-) Maybe document this somewhere? @laraform

from laraform.

laraform avatar laraform commented on May 24, 2024

Thanks @mike2410, I've updated the comment as well as the docs.

from laraform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.