Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Enable editor opts again; Fix reference delete whitespace bug
Tomas Valenta49a3c5460a99
diff --git a/editor/extensions/reference.ts b/editor/extensions/reference.tsindex 68ee95ffe..3a8479931 100644--- a/editor/extensions/reference.ts+++ b/editor/extensions/reference.ts@@ -119,28 +119,28 @@ export default Node.create<ReferenceOptions>({})},- // addKeyboardShortcuts() {- // return {- // Backspace: () => this.editor.commands.command(({ tr, state }) => {- // let isReference = false- // const { selection } = state- // const { empty, anchor } = selection-- // if (!empty) {- // return false- // }-- // state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {- // if (node.type.name === this.name) {- // isReference = true- // tr.insertText(this.options.suggestion.char || '', pos, pos + node.nodeSize)-- // return false- // }- // })-- // return isReference- // }),- // }- // },+ addKeyboardShortcuts() {+ return {+ Backspace: () => this.editor.commands.command(({ tr, state }) => {+ let isReference = false+ const { selection } = state+ const { empty, anchor } = selection++ if (!empty) {+ return false+ }++ state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {+ if (node.type.name === this.name) {+ isReference = true+ tr.insertText(this.options.suggestion.char || '', pos, pos + node.nodeSize)++ return false+ }+ })++ return isReference+ }),+ }+ },})diff --git a/hooks/useDocEditor.ts b/hooks/useDocEditor.tsindex 7fb219368..b7428093a 100644--- a/hooks/useDocEditor.ts+++ b/hooks/useDocEditor.ts@@ -14,10 +14,10 @@ function useDocEditor({}) {const editor = useEditor({content: initialContent,- // parseOptions: {- // preserveWhitespace: 'full',- // },- // injectCSS: false,+ parseOptions: {+ preserveWhitespace: 'full',+ },+ injectCSS: false,editorProps: {attributes: {'data-gramm': 'false',