File tree Expand file tree Collapse file tree
modules/@apostrophecms/rich-text-widget/ui/apos/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -435,6 +435,8 @@ export default {
435435 .filter (Boolean )
436436 .concat (this .aposTiptapExtensions ());
437437
438+ this .ensureExtensionsPriority (extensions);
439+
438440 this .editor = new Editor ({
439441 content: this .initialContent ,
440442 autofocus: this .autofocus ,
@@ -670,6 +672,21 @@ export default {
670672 types: this .tiptapTypes
671673 }));
672674 },
675+ // Find the `defaultNode` extension and ensure it's registered first.
676+ // Any other priority related logic should be handled here.
677+ // Why sorting is important?
678+ // See https://github.com/ProseMirror/prosemirror/issues/1534#issuecomment-2984216986
679+ // related with list item issues and `defaultNode`.
680+ // NOTE: this handler mutates the input array for performance reasons.
681+ ensureExtensionsPriority (extensions ) {
682+ const defaultNodeIndex = extensions .findIndex (ext => ext .name === ' defaultNode' );
683+ if (defaultNodeIndex > 0 ) {
684+ const defaultNode = extensions .splice (defaultNodeIndex, 1 )[0 ];
685+ extensions .unshift (defaultNode);
686+ }
687+
688+ return extensions;
689+ },
673690 showFloatingMenu ({
674691 state, oldState
675692 }) {
Original file line number Diff line number Diff line change 5555 "@tiptap/extension-underline" : " ^2.0.3" ,
5656 "@tiptap/starter-kit" : " ^2.0.3" ,
5757 "@tiptap/vue-3" : " ^2.0.3" ,
58- "prosemirror-model" : " 1.25.0" ,
5958 "@vue/compiler-sfc" : " ^3.3.8" ,
6059 "autoprefixer" : " ^10.4.1" ,
6160 "bluebird" : " ^3.7.2" ,
143142 "browserslist" : [
144143 " ie >= 10"
145144 ]
146- }
145+ }
You can’t perform that action at this time.
0 commit comments