nhn / tui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.
http://ui.toast.com/tui-editor
MIT License
16.91k stars 1.72k forks source link

There is a bug with chart plugin and tab previewStyle in vue3. #3186

Open Mhanto0712 opened 9 months ago

Mhanto0712 commented 9 months ago

Describe the bug

Chart plugin can't use in the editor which is set previewStyle:'tab'.

To Reproduce

  1. Paste chart code in the write block.
  2. "STATUS_BREAKPOINT" in Chrome and "invalid chart data" in Firefox and Edge.

Expected behavior

Successful chart in preview block and WYSIWYG.

Setting

// toast-ui vue3 wrapper const props = defineProps({ modelValue: { type: String, required: false, default: '', }, }); const emit = defineEmits(['update:modelValue']); const toastUiEditor = ref(); const chartOptions = { minWidth: 100, maxWidth: 600, minHeight: 100, maxHeight: 300, };

onMounted(() => { // toast ui const e = new Editor({ el: toastUiEditor.value, height: '70vh', initialEditType: 'markdown', previewStyle: 'tab', plugins: [ [chart, chartOptions], [codeSyntaxHighlight, { highlighter: Prism }], colorSyntax, tableMergedCell, uml, ], language: 'zh-TW', events: { change: () => emit('update:modelValue', e.getMarkdown()), }, }); });


### _Screenshots_

https://github.com/nhn/tui.editor/assets/115198861/772fe57c-5e99-469b-9e33-c76017866311

### _Solution(temporary)_
I add styling to preview block for preventing it become display:none after tab clicking, like the code below:

.toastui-editor-md-preview { display: block !important; }


(I have similar situation at other module which is using mermaid plugin, but I'm not sure if this solution will bring other problems.)