diff --git a/editors/editoria/src/Editoria.js b/editors/editoria/src/Editoria.js index 00db23f7e2959044da90519fc9882b82b5877471..33d5439b3c08ea3e9dfe0925cef274c90a71b700 100644 --- a/editors/editoria/src/Editoria.js +++ b/editors/editoria/src/Editoria.js @@ -62,8 +62,7 @@ const Editoria = () => { autoFocus placeholder="Type Something..." fileUpload={file => renderImage(file)} - value={`<p class="paragraph">hello</p><p class="custom-tag-label-3" data-type="block">Lorem this is <span class="custom-tag-label-1,custom-tag-label-2" data-type="inline" data-tags="["custom-tag-label-1","custom-tag-label-2"]">text </span>dolor si</p>`} - // value={demo} + value={demo} // readonly layout={layout} // onChange={source => console.log(source)} diff --git a/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js b/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js index f5e8521959a0a62f3bd6ceddfade26f02ddd491d..f6da4040bdf347e77417eecd5522328445d98d20 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js +++ b/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js @@ -1,6 +1,7 @@ -import Tools from '../../lib/Tools'; import { injectable } from 'inversify'; import { wrapIn } from 'prosemirror-commands'; +import { NodeSelection } from 'prosemirror-state'; +import Tools from '../../lib/Tools'; @injectable() class BlockQuote extends Tools { @@ -19,6 +20,20 @@ class BlockQuote extends Tools { return true; }; + get active() { + return state => { + const { $from, to } = state.selection; + const same = $from.sharedDepth(to); + if (same === 0) return false; + const pos = $from.before(same); + const node = NodeSelection.create(state.doc, pos); + if (node.$from.parent.hasMarkup(state.config.schema.nodes.blockquote)) { + return true; + } + return false; + }; + } + get enable() { return state => { return wrapIn(state.config.schema.nodes.blockquote)(state);