Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function toggleWrap(type) {
if (blockTypeIsActive(type)) {
return lift(view.state, view.dispatch);
}
const wrapFunction = wrapIn(type);
return wrapFunction(view.state, view.dispatch);
}
/* -------------- */
function toggleWrap(type) {
if (blockTypeIsActive(type)) {
return lift(view.state, view.dispatch);
}
const wrapFunction = wrapIn(type);
return wrapFunction(view.state, view.dispatch);
}
/* -------------- */
function toggleWrapList(type) {
if (blockTypeIsActive(type)) {
return lift(view.state, view.dispatch);
}
const wrapFunction = wrapInList(type);
return wrapFunction(view.state, view.dispatch);
}
/* -------------- */
return (state, dispatch, view) => {
const isActive = nodeIsActive(state, type)
if (isActive) {
return lift(state, dispatch)
}
return wrapIn(type)(state, dispatch, view)
}
}
select: state => lift(state),
icon: "menu-closed"
function toggleWrap(type, isTest) {
const dispatchFunc = isTest ? undefined : editorView.dispatch;
if (blockTypeIsActive(type)) {
return lift(editorView.state, dispatchFunc);
}
const wrapFunction = wrapIn(type);
return wrapFunction(editorView.state, dispatchFunc);
}
export const toggleWrap = (type: NodeType, attrs?: Attrs): CommandFunction => (state, dispatch) => {
const isActive = isNodeActive({ state, type });
if (isActive) {
return lift(state, dispatch);
}
return wrapIn(type, attrs)(state, dispatch);
};
lift = () => lift(this.props.view.state, this.props.view.dispatch)
render() {
liftFromHeading() {
const node = ContentEditorService.getSelectedNode(this.view.state);
if (node !== null) {
let lifted;
do {
lifted = lift(this.view.state, this.view.dispatch);
} while (lifted && this.testIsInHeading(node));
}
this.emitClicked();
}