froala / wysiwyg-editor

The next generation Javascript WYSIWYG HTML Editor.
https://www.froala.com/wysiwyg-editor
Other
5.28k stars 672 forks source link

Type error: Cannot read property 'tagName' of undefined on fontSize.apply method #3286

Closed mdeprezzo closed 5 years ago

mdeprezzo commented 5 years ago
Expected behavior.

Using a custom button for fontSize, when select size, that size must be applied to the selection text.

Actual behavior.

When i click, and invoke the fontSize.apply(${size}px) cause the error:

Uncaught TypeError: Cannot read property 'tagName' of undefined
Steps to reproduce the problem.

I have a dropdown button component from quasar:

    <q-btn-dropdown icon="fa fa-text-height">
      <q-list link>
        <q-item v-close-overlay v-for="(size, idx) in fontSize" :key="idx" @click.native="frAction('fontSize', size)">
          <q-item-main>
            <q-item-tile label v-text="size"></q-item-tile>
          </q-item-main>
        </q-item>
      </q-list>
    </q-btn-dropdown>   

and here the methods that apply the size:

          case 'fontSize':
            console.log(`size : ${options}px`)
            this.editor.fontSize.apply(`${options}px`)
            break
OS.

Ubuntu 18.10

Browser.

Chrome 71.0.3578.80

stefanneculai commented 5 years ago

Do you think it would be possible to make a jsFiddle to highlight the problem? That would speed-up things a lot. Here is a basic jsFiddle you could use as a starting point: https://jsfiddle.net/froala/wc5c3jhk/.

mdeprezzo commented 5 years ago

@stefanneculai like you said in the other issue opened by me, maybe the focus goes lost for some reason when i try to apply certain actions. But anyway, i tried on jfiddle, and works fine.

stefanneculai commented 5 years ago

Then I would be closing this for now and happy to reopen it if we have a way to reproduce it.

mdeprezzo commented 5 years ago

ok thanks, now for fontsize and indent/outdent actions i fixed using bindclick inside configeditor. Have a nice day