tinymce-vue icon indicating copy to clipboard operation
tinymce-vue copied to clipboard

Is <p> was auto append when I doing ctrl + A & C → ctrl + V in IE with I using paste plugin

Open Charlie50503 opened this issue 4 years ago • 5 comments
trafficstars

What is the current behavior?

In IE 11 1.input something in tinymce 2.ctrl + A → ctrl + C to copy content 3.ctrk + V is p tag auto append text content. forced_root_block='' is not working with this problem.

**Please provide the steps to reproduce and if possible a minimal demo of the problem via Example

What is the expected behavior? p tag is not need,how could I del p tag?

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-vue?

browser : IE 11
OS: windows 10
tinymce-vue: 3.2.6
tinymce: 5.6.0
vue: 2.6.12

Charlie50503 avatar Dec 28 '20 07:12 Charlie50503

Hi @Charlie50503

The <p> tag is part of the html content of the editor. If you don't use the v-model binding you can set the editor output to text instead but if you want to reset the content back in the editor from text that will be problematic.

jscasca avatar Dec 31 '20 01:12 jscasca

Thanks for your reply.

definite pattern is (in IE)

  1. input something in editor
  2. copy some text form .txt file
  3. ctrl + A → ctrl + V
  4. p tag auto append text content.

It's specifications in IE? or it's a bug?

I think is the reason of I using forced_root_block='',so paste processing not support. is that right?

Charlie50503 avatar Jan 04 '21 01:01 Charlie50503

Hi @jscasca Is another way to fix this problem ? I have to using v-model and html content. forced_root_block:false seem not work with this case.

Charlie50503 avatar Mar 09 '21 01:03 Charlie50503

Hi @Charlie50503

What is your particular use case? You can probably strip html tags using a node filter but that might be tricky with the v-model. Is there a particular reason for you to use v-model instead of just using onChange or something similar?

jscasca avatar Mar 09 '21 21:03 jscasca

Hi @jscasca I trying to use onChange or

editor.on('Change KeyUp Undo Redo', (event) => {
    this.$emit('input', editor.getContent())
})

but is not work. I noticed that my explanation was incorrect.

This phenomenon will happen when I use "paste" plguin.

init: {
    inline: false,
    skin_url: './tinymce/skins/ui/oxide',
    content_css: './tinymce/skins/content/default/content.css',
    //plugins: ['paste'],←comment out this row will be normal
    importcss_append: true,
    forced_root_block: '',
    paste_preprocess: function(plugin, args) {
      console.log(args.content)
    },
  },

but I have to using paste_preprocess method to limit image size

//in my source
paste_preprocess: (plugin, args) => {
    if (
      !args.content.includes('<img') &&
      args.content.bytes() > this.maxlength
    ) {
      args.content = this.$t('Tinymce.msg.paste_oversize')
    } else {
      this.my_value = args.content
    }
  }

Is another way to replace this function?

Charlie50503 avatar Mar 15 '21 02:03 Charlie50503