How to use prosemirror-dropcursor - 6 common examples

To help you get started, we’ve selected a few prosemirror-dropcursor 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 namiwang / fiber-note / app / javascript / controllers / note / editor.ts View on Github external
constructor(
    editorHolder: Element,
    contentHolder: Element
  ) {
    let state = EditorState.create({
      doc: DOMParser.fromSchema(schema).parse(contentHolder),
      plugins: [
        buildInputRules(schema),
        // TODO keymap around enter -> new list item
        // https://discuss.prosemirror.net/t/lists-paragraph-inside-li-instead-of-new-list-item/455
        // TODO keymap around tab and shift-tab
        // TODO extract hints about available keys
        // https://github.com/prosemirror/prosemirror-example-setup/blob/master/src/keymap.js
        keymap(buildKeymap(schema)),
        keymap(baseKeymap),
        dropCursor(),
        gapCursor(),
        history(),
      ]
    })

    this.view = new EditorView(editorHolder, {
      state: state,
      dispatchTransaction(transaction) {
        let view = this

        transaction.before

        console.log(`transaction`)
        console.log(transaction.before)
        console.log(transaction.doc)
github chanzuckerberg / czi-prosemirror / src / configs.js View on Github external
function buildPlugins(schema: Schema): Array<Plugin> {

  const plugins = [
    new EditorAttributesPlugin(),
    new CursorPlaceholderPlugin(),
    new SelectionPlaceholderPlugin(),
    new LinkTooltipPlugin(),

    buildInputRules(schema),
    dropCursor(),
    gapCursor(),
    history(),
    keymap(buildKeymap(schema)),
    keymap(baseKeymap),

    // Tables
    // https://github.com/ProseMirror/prosemirror-tables/blob/master/demo.js
    columnResizing(),
    tableEditing(),
  ];

  return plugins;
}
github tinacms / tinacms / packages / tinacms / fields / src / Wysiwyg / state / index.ts View on Github external
schema: Schema,
  translator: Translator,
  plugins: Plugin[],
  value: string,
  frame: any,
  theme: any // TODO: update type
) {
  return EditorState.create({
    schema,
    doc: translator.nodeFromString(value),
    plugins: [
      inputRules(schema),
      keymap(buildKeymap(schema, plugins)),
      history(),
      links(schema, frame, theme),
      dropCursor({ width: 2, color: 'rgb(33, 224, 158)' }),
      gapCursor(),
      menu(translator, false, frame, theme),
    ],
  })
}
github scrumpy / tiptap / packages / tiptap / src / Editor.js View on Github external
createState() {
    return EditorState.create({
      schema: this.schema,
      doc: this.createDocument(this.options.content),
      plugins: [
        ...this.plugins,
        inputRules({
          rules: this.inputRules,
        }),
        ...this.pasteRules,
        ...this.keymaps,
        keymap({
          Backspace: undoInputRule,
        }),
        keymap(baseKeymap),
        dropCursor(this.options.dropCursor),
        gapCursor(),
        new Plugin({
          key: new PluginKey('editable'),
          props: {
            editable: () => this.options.editable,
          },
        }),
        new Plugin({
          props: {
            attributes: {
              tabindex: 0,
            },
            handleDOMEvents: {
              focus: (view, event) => {
                this.focused = true
                this.emit('focus', {
github ProseMirror / prosemirror-example-setup / src / index.js View on Github external
export function exampleSetup(options) {
  let plugins = [
    buildInputRules(options.schema),
    keymap(buildKeymap(options.schema, options.mapKeys)),
    keymap(baseKeymap),
    dropCursor(),
    gapCursor()
  ]
  if (options.menuBar !== false)
    plugins.push(menuBar({floating: options.floatingMenu !== false,
                          content: options.menuContent || buildMenuItems(options.schema).fullMenu}))
  if (options.history !== false)
    plugins.push(history())

  return plugins.concat(new Plugin({
    props: {
      attributes: {class: "ProseMirror-example-setup-style"}
    }
  }))
}
github ifiokjr / remirror / @remirror / core-extensions / src / extensions / drop-cursor-extension.ts View on Github external
public plugin() {
    const { color, width } = this.options;

    return dropCursor({ color, width });
  }
}

prosemirror-dropcursor

Drop cursor plugin for ProseMirror

MIT
Latest version published 1 month ago

Package Health Score

73 / 100
Full package analysis

Popular prosemirror-dropcursor functions

Similar packages