Skip to content
Snippets Groups Projects
Commit b6543b9b authored by chris's avatar chris
Browse files

blockquote active

parent d2cae678
No related branches found
No related tags found
1 merge request!243Feature improvments
...@@ -62,8 +62,7 @@ const Editoria = () => { ...@@ -62,8 +62,7 @@ const Editoria = () => {
autoFocus autoFocus
placeholder="Type Something..." placeholder="Type Something..."
fileUpload={file => renderImage(file)} 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="[&quot;custom-tag-label-1&quot;,&quot;custom-tag-label-2&quot;]">text </span>dolor si</p>`} value={demo}
// value={demo}
// readonly // readonly
layout={layout} layout={layout}
// onChange={source => console.log(source)} // onChange={source => console.log(source)}
......
import Tools from '../../lib/Tools';
import { injectable } from 'inversify'; import { injectable } from 'inversify';
import { wrapIn } from 'prosemirror-commands'; import { wrapIn } from 'prosemirror-commands';
import { NodeSelection } from 'prosemirror-state';
import Tools from '../../lib/Tools';
@injectable() @injectable()
class BlockQuote extends Tools { class BlockQuote extends Tools {
...@@ -19,6 +20,20 @@ class BlockQuote extends Tools { ...@@ -19,6 +20,20 @@ class BlockQuote extends Tools {
return true; 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() { get enable() {
return state => { return state => {
return wrapIn(state.config.schema.nodes.blockquote)(state); return wrapIn(state.config.schema.nodes.blockquote)(state);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment