From 6b5c44c97a51698dc360d0d111d0538f388d5791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Wed, 9 Jun 2021 10:53:20 +0200 Subject: [PATCH] remove nested experiment --- .../demos/Experiments/Nested/CustomNode.js | 80 ------------- .../demos/Experiments/Nested/CustomNode.vue | 106 ------------------ docs/src/demos/Experiments/Nested/Nested.vue | 45 -------- docs/src/demos/Experiments/Nested/index.vue | 50 --------- 4 files changed, 281 deletions(-) delete mode 100644 docs/src/demos/Experiments/Nested/CustomNode.js delete mode 100644 docs/src/demos/Experiments/Nested/CustomNode.vue delete mode 100644 docs/src/demos/Experiments/Nested/Nested.vue delete mode 100644 docs/src/demos/Experiments/Nested/index.vue diff --git a/docs/src/demos/Experiments/Nested/CustomNode.js b/docs/src/demos/Experiments/Nested/CustomNode.js deleted file mode 100644 index 4b95abce..00000000 --- a/docs/src/demos/Experiments/Nested/CustomNode.js +++ /dev/null @@ -1,80 +0,0 @@ -import { Node, mergeAttributes } from '@tiptap/core' -import { VueNodeViewRenderer } from '@tiptap/vue-2' -import { Plugin } from 'prosemirror-state' - -import CustomNodeView from './CustomNode.vue' - -export default Node.create({ - name: 'customNode', - isBlock: true, - inline: false, - group: 'block', - draggable: true, - isolating: true, - defining: true, - selectable: true, - - addAttributes() { - return { - nest: { default: false }, - } - }, - - parseHTML() { - return [ - { - tag: 'custom-node', - }, - ] - }, - - renderHTML({ HTMLAttributes }) { - return ['custom-node', mergeAttributes(HTMLAttributes)] - }, - - addNodeView() { - return VueNodeViewRenderer(CustomNodeView) - }, - - addProseMirrorPlugins() { - return [ - new Plugin({ - props: { - handleKeyDown: (view, event) => { - // Prevent _any_ key from clearing block. As soon as you start typing, - // and a block is focused, it'll blast the block away. - view.state.typing = true - }, - - handlePaste: (view, event, slice) => { - // Prevent pasting overwriting block - view.state.pasting = true - }, - }, - - filterTransaction: (transaction, state) => { - let result = true - - // Check if our flags are set, and if the selected node is a custom node - if (state.typing || state.pasting) { - transaction.mapping.maps.forEach(map => { - map.forEach((oldStart, oldEnd, newStart, newEnd) => { - state.doc.nodesBetween( - oldStart, - oldEnd, - (node, number, pos, parent, index) => { - if (node.type.name === 'customNode') { - result = false - } - }, - ) - }) - }) - } - - return result - }, - }), - ] - }, -}) diff --git a/docs/src/demos/Experiments/Nested/CustomNode.vue b/docs/src/demos/Experiments/Nested/CustomNode.vue deleted file mode 100644 index bf299fab..00000000 --- a/docs/src/demos/Experiments/Nested/CustomNode.vue +++ /dev/null @@ -1,106 +0,0 @@ - - - - - diff --git a/docs/src/demos/Experiments/Nested/Nested.vue b/docs/src/demos/Experiments/Nested/Nested.vue deleted file mode 100644 index 0cd31e6a..00000000 --- a/docs/src/demos/Experiments/Nested/Nested.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - - - diff --git a/docs/src/demos/Experiments/Nested/index.vue b/docs/src/demos/Experiments/Nested/index.vue deleted file mode 100644 index 8aee6c13..00000000 --- a/docs/src/demos/Experiments/Nested/index.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - -