Browse Source

富文本可设置标题级别

zq 1 tháng trước cách đây
mục cha
commit
a3be2569ff
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      src/components/RichText.vue

+ 4 - 2
src/components/RichText.vue

@@ -604,7 +604,7 @@ export default {
       if (!editor) return;
       const header = editor.editorContainer?.querySelector('.tox-editor-header');
       if (header) {
-        header.style.display = !isTitle ? '' : 'none';
+        header.style.display = isTitle ? 'none' : '';
         if (isTitle && !isInit) {
           const body = editor.getBody();
           if (!body) return;
@@ -613,6 +613,8 @@ export default {
           if (this.processHtmlString && typeof this.processHtmlString === 'function') {
             this.processHtmlString(pElements, {}, true);
           }
+          editor.fire('change');
+          editor.nodeChanged();
         }
       }
     },
@@ -1230,7 +1232,7 @@ export default {
         {
           acceptNode: (node) => (node.textContent.trim() ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT),
         },
-        false
+        false,
       );
       return walker.nextNode();
     },