How to use the prosemirror-schema-list.wrapInList function in prosemirror-schema-list

To help you get started, we’ve selected a few prosemirror-schema-list 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 / FormattingMenu / formattingMenuConfig.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 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 ProseMirror / prosemirror-example-setup / src / menu.js View on Github external
function wrapListItem(nodeType, options) {
  return cmdItem(wrapInList(nodeType, options.attrs), options)
}
github ifiokjr / remirror / @remirror / core / src / commands / toggle-list.ts View on Github external
export const toggleList = (type: NodeType, itemType: NodeType): CommandFunction => (state, dispatch) => {
  const isActive = nodeActive(state, type);

  if (isActive) {
    return liftListItem(itemType)(state, dispatch);
  }

  return wrapInList(type)(state, dispatch);
};
github ProseMirror / prosemirror-example-setup / src / keymap.js View on Github external
bind("Mod-BracketLeft", lift)
  bind("Escape", selectParentNode)

  if (type = schema.marks.strong) {
    bind("Mod-b", toggleMark(type))
    bind("Mod-B", toggleMark(type))
  }
  if (type = schema.marks.em) {
    bind("Mod-i", toggleMark(type))
    bind("Mod-I", toggleMark(type))
  }
  if (type = schema.marks.code)
    bind("Mod-`", toggleMark(type))

  if (type = schema.nodes.bullet_list)
    bind("Shift-Ctrl-8", wrapInList(type))
  if (type = schema.nodes.ordered_list)
    bind("Shift-Ctrl-9", wrapInList(type))
  if (type = schema.nodes.blockquote)
    bind("Ctrl->", wrapIn(type))
  if (type = schema.nodes.hard_break) {
    let br = type, cmd = chainCommands(exitCode, (state, dispatch) => {
      dispatch(state.tr.replaceSelectionWith(br.create()).scrollIntoView())
      return true
    })
    bind("Mod-Enter", cmd)
    bind("Shift-Enter", cmd)
    if (mac) bind("Ctrl-Enter", cmd)
  }
  if (type = schema.nodes.list_item) {
    bind("Enter", splitListItem(type))
    bind("Mod-[", liftListItem(type))
github nib-edit / Nib / packages / core / src / plugins / list / commands.js View on Github external
const wrapIntoList = (state, dispatch, listType) => {
  return baseCommand.autoJoin(
    wrapInList(listType),
    (before, after) => before.type === after.type && before.type === listType
  )(state, dispatch);
};
github alidcastano / vue-prosemirror-editor / src / plugins / keys.js View on Github external
    'Shift-Ctrl-9': (orderedList) => wrapInList(orderedList),
    'Enter': (hardBreak) => chainCommands(exitCode, insertNode(hardBreak)),
github cosmocode / dokuwiki-plugin-prosemirror / script / plugins / Menu / MenuItems / OrderedListMenuItemDispatcher.js View on Github external
static getMenuItem(schema) {
        if (!this.isAvailable(schema)) {
            throw new Error('Ordered list not available in schema!');
        }
        return new MenuItem({
            icon: svgIcon('format-list-numbers'),
            command: wrapInList(schema.nodes.ordered_list, {}),
            label: LANG.plugins.prosemirror['label:orderedList'],
        });
    }
}
github cosmocode / dokuwiki-plugin-prosemirror / script / plugins / Menu / MenuItems / BulletListMenuItemDispatcher.js View on Github external
static getMenuItem(schema) {
        if (!this.isAvailable(schema)) {
            throw new Error('Bullet list not available in schema!');
        }
        return new MenuItem({
            icon: svgIcon('format-list-bulleted'),
            command: wrapInList(schema.nodes.bullet_list, {}),
            label: LANG.plugins.prosemirror['label:bulletList'],
        });
    }
}