How to use the prosemirror-commands.lift function in prosemirror-commands

To help you get started, we’ve selected a few prosemirror-commands examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pubpub / pubpub-editor / src / addons / HeaderMenu / headerMenuConfig.js View on Github external
function toggleWrap(type) {
		if (blockTypeIsActive(type)) {
			return lift(view.state, view.dispatch);
		}
		const wrapFunction = wrapIn(type);
		return wrapFunction(view.state, view.dispatch);
	}
	/* -------------- */
github pubpub / pubpub-editor / src / addons / FormattingMenu / formattingMenuConfig.js View on Github external
function toggleWrap(type) {
		if (blockTypeIsActive(type)) {
			return lift(view.state, view.dispatch);
		}
		const wrapFunction = wrapIn(type);
		return wrapFunction(view.state, view.dispatch);
	}
	/* -------------- */
github pubpub / pubpub-editor / src / addons / HeaderMenu / headerMenuConfig.js View on Github external
function toggleWrapList(type) {
		if (blockTypeIsActive(type)) {
			return lift(view.state, view.dispatch);
		}
		const wrapFunction = wrapInList(type);
		return wrapFunction(view.state, view.dispatch);
	}
	/* -------------- */
github scrumpy / tiptap / packages / tiptap-commands / src / commands / toggleWrap.js View on Github external
return (state, dispatch, view) => {
    const isActive = nodeIsActive(state, type)

    if (isActive) {
      return lift(state, dispatch)
    }

    return wrapIn(type)(state, dispatch, view)
  }
}
github pubpub / pubpub-editor / src / plugins / onChange.js View on Github external
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);
	}
github ifiokjr / remirror / @remirror / core-utils / src / command-utils.ts View on Github external
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);
};
github gamejolt / frontend-lib / components / content / content-editor / controls / text / controls.ts View on Github external
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();
	}