diff --git a/editors/editoria/src/config/config.js b/editors/editoria/src/config/config.js index 9f5664137fb1816c10f1638eac40494e17e1a25f..8d590553cc2a5af26b05d096a4d9dcff7e74c98c 100644 --- a/editors/editoria/src/config/config.js +++ b/editors/editoria/src/config/config.js @@ -134,8 +134,8 @@ export default { tags: [ { label: 'custom-tag-label-1', tagType: 'inline' }, { label: 'custom-tag-label-2', tagType: 'inline' }, - { label: 'custom-tag-label-3', tagType: 'block' } - ] + { label: 'custom-tag-label-3', tagType: 'block' }, + ], }, // Always load first CommentsService and LinkService, diff --git a/editors/editoria/src/layout/EditorElements.js b/editors/editoria/src/layout/EditorElements.js index 4a84b86d931ae48d8cd329217851b466d9200404..7a4e636a32adb4b851adbc175bbf1ccf5ebf8ef3 100644 --- a/editors/editoria/src/layout/EditorElements.js +++ b/editors/editoria/src/layout/EditorElements.js @@ -392,13 +392,13 @@ export default css` .custom-tag-inline { font-weight: 500; - } + } .custom-tag-inline:before { content: ' | '; color: #006f19; font-weight: 600; - margin-left: 0 + margin-left: 0; } .custom-tag-inline:after { @@ -413,22 +413,22 @@ export default css` color: #006f19; } - .custom-tag-block:before { - content: '"'; + custom-tag-block:before { color: #006f19; + content: '"'; + display: inline; font-weight: 600; - margin-left: 0 + margin-left: 0; } - .custom-tag-block:after { + custom-tag-block:after { + color: #006f19; content: '"'; display: inline; - color: #006f19; font-weight: 600; } .transform-icon { transform: rotate(40deg); } - `; diff --git a/wax-prosemirror-schema/src/nodes/customBlockNode.js b/wax-prosemirror-schema/src/nodes/customBlockNode.js index 5af53d2995b8b2f6cafc6012eac7fe750850ff9e..86d3bc95d53bc0f617c26803f807d8485f7cc661 100644 --- a/wax-prosemirror-schema/src/nodes/customBlockNode.js +++ b/wax-prosemirror-schema/src/nodes/customBlockNode.js @@ -1,26 +1,26 @@ const customBlockNode = { - content: "inline*", - group: "block", + content: 'inline*', + group: 'block', priority: 0, defining: true, attrs: { - class: { default: "custom-tag-block" } + class: { default: '' }, }, parseDOM: [ { - tag: "custom-tag-block", + tag: 'custom-tag-block', getAttrs(hook, next) { Object.assign(hook, { - class: hook.dom.getAttribute("class") + class: hook.dom.getAttribute('class'), }); next(); - } - } + }, + }, ], toDOM(hook, next) { - const attrs = { class: hook.attrs.class }; - return hook.value = ["custom-tag-block", attrs, 0]; - } + const attrs = { class: hook.attrs.class }; + return (hook.value = ['custom-tag-block', attrs, 0]); + }, }; export default customBlockNode; diff --git a/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js b/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js index 4584f38c25d8765b45185358d1b2ece30d6054da..7af3d174db61561c5f3b757e6a2f775434b53b75 100644 --- a/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js +++ b/wax-prosemirror-services/src/CustomTagService/CustomTagBlockService/CustomTagBlockTool.js @@ -8,7 +8,7 @@ class CustomTagBlockTool extends Tools { get run() { return (state, dispatch, val) => { Commands.setBlockType(state.config.schema.nodes.customTagBlock, { - class: `custom-tag-block ${val}`, + class: val, })(state, dispatch); }; } @@ -17,6 +17,7 @@ class CustomTagBlockTool extends Tools { return state => { return Commands.customTagBlockActive( state.config.schema.nodes.customTagBlock, + { class: 'custom-tag-label-3' }, )(state); }; } diff --git a/wax-prosemirror-utilities/src/commands/Commands.js b/wax-prosemirror-utilities/src/commands/Commands.js index 3b5429c081a08601f937d06d98193e4034af2a03..c106b34f5007a3724c6c6ab3450d8370bf993b9b 100644 --- a/wax-prosemirror-utilities/src/commands/Commands.js +++ b/wax-prosemirror-utilities/src/commands/Commands.js @@ -55,7 +55,11 @@ const blockActive = (nodeType, attrs = {}) => { }; }; -const customTagBlockActive = (type, attrs = {}) => state => {}; +const customTagBlockActive = (type, attrs = {}) => state => { + const { $from } = state.selection; + console.log('type', type); + console.log($from); +}; // const blockActive = (type, attrs = {}) => state => { // const { $from, to, node } = state.selection;