Text becomes blank if DOM elements are added or removed around tinymce instance

Aperta
#230 11 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Start with the provided Vue component example and working CodePen, then reproduce the issue by toggling the checkbox while observing the TinyMCE editor. Investigate how the TinyMCE Vue component handles its editor content when Vue moves its containing DOM element. Done means the editor text remains visible and editable after the surrounding paragraphs are added or removed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug GitHub status: escalated

What is the current behavior?
Text becomes blank and is not editable if parent siblings in DOM tree are removed or added.

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

<script>
import TinyMce from '@tinymce/tinymce-vue';

export default {
  components: {
    TinyMce,
  },
  data: function() {
    return {
      text: 'text',
      instructionsVisible: false,
    };
  },
};
</script>

<template lang="html">
  <div>
    <label><input type="checkbox" v-model="instructionsVisible" /> Click me</label>
    <p v-if="instructionsVisible">Lorem ipsum dolor sit amet</p>
    <div><tiny-mce v-model="text"/></div>
    <p v-if="instructionsVisible">Lorem ipsum dolor sit amet</p>
  </div>
</template>

Working demo: https://codepen.io/lwd8cmd/pen/rNWbXYx

Bug is probably caused by Vue moving div block containing tiny-mce editor around in DOM tree if p-tags are added. Vue doesn't keep content in another document (editable text held in iframe) if div block is moved to another location in DOM.

Call stack:

  • Vue._update
  • patch - update DOM structure
  • patchVnode - patch existing root node (root div)
  • updateChildren - update root div children (remove p tags, move div tag containing tiny-mce component)
  • insertBefore - move div containing tiny-mce component to another location

What is the expected behavior?
Text editor content shouldn't change, text should stay editable.

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-vue?
Bug occurred in Tinymce-vue 3.0 and 3.2.8. Tested using Chrome 88, but bug should be browser-agnostic.

Lingua principale
TypeScript
Stelle
2.2k
Fork
217
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tinymce/tinymce-vue

Tutte le issue di tinymce/tinymce-vue

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.