@krainovsd/markdown-editor 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/{index-BXzCwUix.js → index--WqbgHNW.js} +2 -2
- package/lib/cjs/{index-BXzCwUix.js.map → index--WqbgHNW.js.map} +1 -1
- package/lib/cjs/{index-B3pzIJIg.js → index-DULzPQ7W.js} +5 -3
- package/lib/cjs/index-DULzPQ7W.js.map +1 -0
- package/lib/cjs/index.js +1 -1
- package/lib/esm/extensions/keymaps/init-key-map.js.map +1 -1
- package/lib/esm/extensions/listeners/get-change-event.js.map +1 -1
- package/lib/esm/extensions/listeners/get-focus-event.js +0 -1
- package/lib/esm/extensions/listeners/get-focus-event.js.map +1 -1
- package/lib/esm/lib/utils/overlap-mark.js.map +1 -1
- package/lib/esm/module/Editor/lib/init-editor-provider.js +3 -1
- package/lib/esm/module/Editor/lib/init-editor-provider.js.map +1 -1
- package/lib/index.d.ts +30 -12
- package/package.json +1 -1
- package/lib/cjs/index-B3pzIJIg.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlap-mark.js","sources":["../../../../src/lib/utils/overlap-mark.ts"],"sourcesContent":["import type { EditorState } from \"@codemirror/state\";\n\ntype OverlapMarkOptions = {\n state: EditorState;\n shift: number;\n marks: (number | undefined)[];\n requireMatched: number[];\n};\n\nexport function overlapMark({ marks, shift, state, requireMatched }: OverlapMarkOptions) {\n const { from, to, shiftAfterInner, shiftAfterOuter, shiftBeforeInner, shiftBeforeOuter, text } =\n processShiftContent(state, shift, marks);\n\n const startIndex = findMarkIndex(\n text.substring(0, shiftBeforeInner + shiftBeforeOuter),\n marks,\n requireMatched,\n \"right\",\n );\n const endIndex = findMarkIndex(\n text.substring(text.length - shiftAfterInner - shiftAfterOuter),\n marks,\n requireMatched,\n \"left\",\n );\n\n const start = ~startIndex ? from - shiftBeforeOuter + startIndex : -1;\n const end = ~endIndex ? to - shiftAfterInner + endIndex : -1;\n\n // console.log({\n // from,\n // to,\n // shiftAfterInner,\n // shiftAfterOuter,\n // shiftBeforeInner,\n // shiftBeforeOuter,\n // text,\n // textStart: text.substring(0, shiftBeforeInner + shiftBeforeOuter),\n // textEnd: text.substring(text.length - shiftAfterInner - shiftAfterOuter),\n // startIndex,\n // endIndex,\n // end,\n // start,\n // });\n\n return {\n start,\n end,\n marked: Boolean(~start || ~end),\n originalText: text.substring(shiftBeforeOuter, text.length - shiftAfterOuter),\n };\n}\n\n// eslint-disable-next-line max-params\nfunction findMarkIndex(\n text: string,\n marks: (number | undefined)[],\n requireMatched: number[],\n direction: \"right\" | \"left\" = \"right\",\n) {\n if (text.length === 0) return -1;\n\n const maxRequired = Math.max(...requireMatched);\n const minRequired = Math.min(...requireMatched);\n\n let pos = 0;\n let matched = 0;\n let start = -1;\n\n for (const mark of marks) {\n if (!mark) continue;\n\n while (pos < text.length) {\n if (text.codePointAt(pos) === mark) matched++;\n else {\n if (\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n requireMatched.some((rm) => rm === matched) &&\n ((direction === \"right\" && pos - matched > start) ||\n (direction === \"left\" && (pos - matched < start || start === -1)))\n ) {\n start = direction === \"right\" ? pos - minRequired : pos - matched;\n // console.log({ pos, matched, start, minRequired, maxRequired, direction });\n } else if (maxRequired < matched) {\n const posMin = pos - minRequired;\n const posMax = pos - matched;\n\n // console.log({ posMin, posMax, pos, minRequired, maxRequired, direction, matched });\n\n // eslint-disable-next-line max-depth\n if (direction === \"right\" && posMin > start) start = posMin;\n // eslint-disable-next-line max-depth\n if (direction === \"left\" && (posMax < start || start === -1)) start = posMax;\n }\n matched = 0;\n }\n pos++;\n }\n\n if (\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n requireMatched.some((rm) => rm === matched) &&\n ((direction === \"right\" && pos - matched > start) ||\n (direction === \"left\" && (pos - matched < start || start === -1)))\n ) {\n start = direction === \"right\" ? pos - minRequired : pos - matched;\n // console.log({ pos, matched, start, minRequired, maxRequired, direction });\n } else if (maxRequired < matched) {\n const posMin = pos - minRequired;\n const posMax = pos - matched;\n\n // console.log({ posMin, posMax, pos, minRequired, maxRequired, direction, matched });\n\n if (direction === \"right\" && posMin > start) start = posMin;\n if (direction === \"left\" && (posMax < start || start === -1)) start = posMax;\n }\n\n pos = 0;\n matched = 0;\n }\n\n return start;\n}\n\nfunction processShiftContent(state: EditorState, shift: number, marks: (number | undefined)[]) {\n const { from, to } = state.selection.ranges[0];\n const linePoint = state.lineBreak.codePointAt(0);\n let pos = 0;\n\n /** processing outer shifts */\n const initialTextBefore = state.sliceDoc(from - shift, from);\n let shiftBeforeOuter = 0;\n pos = initialTextBefore.length - 1;\n\n while (pos > -1) {\n if (initialTextBefore.codePointAt(pos) === linePoint) break;\n shiftBeforeOuter++;\n pos--;\n }\n\n const initialTextAfter = state.sliceDoc(to, to + shift);\n let shiftAfterOuter = 0;\n pos = 0;\n\n while (pos < initialTextAfter.length) {\n if (initialTextAfter.codePointAt(pos) === linePoint) break;\n shiftAfterOuter++;\n pos++;\n }\n\n /** processing inner shifts */\n const initialText = state.sliceDoc(from, to);\n let shiftBeforeInner = 0;\n pos = 0;\n\n if (initialText.length > 1)\n while (pos < initialText.length) {\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n if (marks.some((mark) => mark === initialText.codePointAt(pos))) shiftBeforeInner++;\n else break;\n\n pos++;\n }\n\n const initialTextWithoutBeforeShift = initialText.substring(shiftBeforeInner + 1);\n let shiftAfterInner = 0;\n pos = initialTextWithoutBeforeShift.length - 1;\n\n if (initialText.length > 1 || shiftBeforeInner > 0)\n while (pos > -1) {\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n if (marks.some((mark) => mark === initialTextWithoutBeforeShift.codePointAt(pos)))\n shiftAfterInner++;\n else break;\n\n pos--;\n }\n\n const text = state.sliceDoc(from - shiftBeforeOuter, to + shiftAfterOuter);\n\n return {\n from,\n to,\n shiftBeforeOuter,\n shiftBeforeInner,\n shiftAfterOuter,\n shiftAfterInner,\n text,\n };\n}\n"],"names":[],"mappings":"AASM,SAAU,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAsB,EAAA;IACrF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAC5F,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAE1C,MAAM,UAAU,GAAG,aAAa,CAC9B,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,EACtD,KAAK,EACL,cAAc,EACd,OAAO,CACR;IACD,MAAM,QAAQ,GAAG,aAAa,CAC5B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,eAAe,GAAG,eAAe,CAAC,EAC/D,KAAK,EACL,cAAc,EACd,MAAM,CACP;AAED,IAAA,MAAM,KAAK,GAAG,CAAC,UAAU,GAAG,IAAI,GAAG,gBAAgB,GAAG,UAAU,GAAG,EAAE;AACrE,IAAA,MAAM,GAAG,GAAG,CAAC,QAAQ,GAAG,EAAE,GAAG,eAAe,GAAG,QAAQ,GAAG,EAAE;;;;;;;;;;;;;;;;IAkB5D,OAAO;QACL,KAAK;QACL,GAAG;QACH,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC;AAC/B,QAAA,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;KAC9E;AACH;AAEA;AACA,SAAS,aAAa,CACpB,IAAY,EACZ,KAA6B,EAC7B,cAAwB,EACxB,SAAA,GAA8B,OAAO,EAAA;AAErC,IAAA,IAAI,IAAI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EAAE,EAAE;;AAEf,YAAA,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,6BAA6B,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/E,gBAAA,eAAe,EAAE;;gBACd;AAEL,YAAA,GAAG,EAAE;;AAGT,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,gBAAgB,EAAE,EAAE,GAAG,eAAe,CAAC;IAE1E,OAAO;QACL,IAAI;QACJ,EAAE;QACF,gBAAgB;QAChB,gBAAgB;QAChB,eAAe;QACf,eAAe;QACf,IAAI;KACL;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"overlap-mark.js","sources":["../../../../src/lib/utils/overlap-mark.ts"],"sourcesContent":["import type { EditorState } from \"@/module\";\n\ntype OverlapMarkOptions = {\n state: EditorState;\n shift: number;\n marks: (number | undefined)[];\n requireMatched: number[];\n};\n\nexport function overlapMark({ marks, shift, state, requireMatched }: OverlapMarkOptions) {\n const { from, to, shiftAfterInner, shiftAfterOuter, shiftBeforeInner, shiftBeforeOuter, text } =\n processShiftContent(state, shift, marks);\n\n const startIndex = findMarkIndex(\n text.substring(0, shiftBeforeInner + shiftBeforeOuter),\n marks,\n requireMatched,\n \"right\",\n );\n const endIndex = findMarkIndex(\n text.substring(text.length - shiftAfterInner - shiftAfterOuter),\n marks,\n requireMatched,\n \"left\",\n );\n\n const start = ~startIndex ? from - shiftBeforeOuter + startIndex : -1;\n const end = ~endIndex ? to - shiftAfterInner + endIndex : -1;\n\n // console.log({\n // from,\n // to,\n // shiftAfterInner,\n // shiftAfterOuter,\n // shiftBeforeInner,\n // shiftBeforeOuter,\n // text,\n // textStart: text.substring(0, shiftBeforeInner + shiftBeforeOuter),\n // textEnd: text.substring(text.length - shiftAfterInner - shiftAfterOuter),\n // startIndex,\n // endIndex,\n // end,\n // start,\n // });\n\n return {\n start,\n end,\n marked: Boolean(~start || ~end),\n originalText: text.substring(shiftBeforeOuter, text.length - shiftAfterOuter),\n };\n}\n\n// eslint-disable-next-line max-params\nfunction findMarkIndex(\n text: string,\n marks: (number | undefined)[],\n requireMatched: number[],\n direction: \"right\" | \"left\" = \"right\",\n) {\n if (text.length === 0) return -1;\n\n const maxRequired = Math.max(...requireMatched);\n const minRequired = Math.min(...requireMatched);\n\n let pos = 0;\n let matched = 0;\n let start = -1;\n\n for (const mark of marks) {\n if (!mark) continue;\n\n while (pos < text.length) {\n if (text.codePointAt(pos) === mark) matched++;\n else {\n if (\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n requireMatched.some((rm) => rm === matched) &&\n ((direction === \"right\" && pos - matched > start) ||\n (direction === \"left\" && (pos - matched < start || start === -1)))\n ) {\n start = direction === \"right\" ? pos - minRequired : pos - matched;\n // console.log({ pos, matched, start, minRequired, maxRequired, direction });\n } else if (maxRequired < matched) {\n const posMin = pos - minRequired;\n const posMax = pos - matched;\n\n // console.log({ posMin, posMax, pos, minRequired, maxRequired, direction, matched });\n\n // eslint-disable-next-line max-depth\n if (direction === \"right\" && posMin > start) start = posMin;\n // eslint-disable-next-line max-depth\n if (direction === \"left\" && (posMax < start || start === -1)) start = posMax;\n }\n matched = 0;\n }\n pos++;\n }\n\n if (\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n requireMatched.some((rm) => rm === matched) &&\n ((direction === \"right\" && pos - matched > start) ||\n (direction === \"left\" && (pos - matched < start || start === -1)))\n ) {\n start = direction === \"right\" ? pos - minRequired : pos - matched;\n // console.log({ pos, matched, start, minRequired, maxRequired, direction });\n } else if (maxRequired < matched) {\n const posMin = pos - minRequired;\n const posMax = pos - matched;\n\n // console.log({ posMin, posMax, pos, minRequired, maxRequired, direction, matched });\n\n if (direction === \"right\" && posMin > start) start = posMin;\n if (direction === \"left\" && (posMax < start || start === -1)) start = posMax;\n }\n\n pos = 0;\n matched = 0;\n }\n\n return start;\n}\n\nfunction processShiftContent(state: EditorState, shift: number, marks: (number | undefined)[]) {\n const { from, to } = state.selection.ranges[0];\n const linePoint = state.lineBreak.codePointAt(0);\n let pos = 0;\n\n /** processing outer shifts */\n const initialTextBefore = state.sliceDoc(from - shift, from);\n let shiftBeforeOuter = 0;\n pos = initialTextBefore.length - 1;\n\n while (pos > -1) {\n if (initialTextBefore.codePointAt(pos) === linePoint) break;\n shiftBeforeOuter++;\n pos--;\n }\n\n const initialTextAfter = state.sliceDoc(to, to + shift);\n let shiftAfterOuter = 0;\n pos = 0;\n\n while (pos < initialTextAfter.length) {\n if (initialTextAfter.codePointAt(pos) === linePoint) break;\n shiftAfterOuter++;\n pos++;\n }\n\n /** processing inner shifts */\n const initialText = state.sliceDoc(from, to);\n let shiftBeforeInner = 0;\n pos = 0;\n\n if (initialText.length > 1)\n while (pos < initialText.length) {\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n if (marks.some((mark) => mark === initialText.codePointAt(pos))) shiftBeforeInner++;\n else break;\n\n pos++;\n }\n\n const initialTextWithoutBeforeShift = initialText.substring(shiftBeforeInner + 1);\n let shiftAfterInner = 0;\n pos = initialTextWithoutBeforeShift.length - 1;\n\n if (initialText.length > 1 || shiftBeforeInner > 0)\n while (pos > -1) {\n // eslint-disable-next-line no-loop-func -- https://eslint.org/docs/latest/rules/no-loop-func#known-limitations\n if (marks.some((mark) => mark === initialTextWithoutBeforeShift.codePointAt(pos)))\n shiftAfterInner++;\n else break;\n\n pos--;\n }\n\n const text = state.sliceDoc(from - shiftBeforeOuter, to + shiftAfterOuter);\n\n return {\n from,\n to,\n shiftBeforeOuter,\n shiftBeforeInner,\n shiftAfterOuter,\n shiftAfterInner,\n text,\n };\n}\n"],"names":[],"mappings":"AASM,SAAU,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAsB,EAAA;IACrF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,eAAe,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C;IAE1E,OAAO;QACL,IAAI;QACJ,EAAE;QACF,gBAAgB;QAChB,gBAAgB;QAChB,eAAe;QACf,eAAe;QACf,IAAI;KACL;AACH;;;;"}
|
|
@@ -8,7 +8,9 @@ async function initEditorProvider({ roomId, url, userName = "Anonymous", userCol
|
|
|
8
8
|
userColor = "#30bced";
|
|
9
9
|
}
|
|
10
10
|
const userColorLight = `${userColor.substring(0, 7)}33`;
|
|
11
|
-
const provider = new WebsocketProvider(url, roomId, multiCursorDocument
|
|
11
|
+
const provider = new WebsocketProvider(url, roomId, multiCursorDocument, {
|
|
12
|
+
disableBc: opts.disableBc,
|
|
13
|
+
});
|
|
12
14
|
provider.awareness.setLocalStateField("user", {
|
|
13
15
|
name: userName,
|
|
14
16
|
color: userColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-editor-provider.js","sources":["../../../../../src/module/Editor/lib/init-editor-provider.ts"],"sourcesContent":["import type { MultiCursorOptions, ProviderStatusEvent } from \"../Editor.types\";\n\ntype InitEditorProviderOptions = {\n initialText?: string;\n} & MultiCursorOptions;\n\nexport async function initEditorProvider({\n roomId,\n url,\n userName = \"Anonymous\",\n userColor,\n initialText,\n ...opts\n}: InitEditorProviderOptions) {\n const { Doc } = await import(\"yjs\");\n const { WebsocketProvider } = await import(\"y-websocket\");\n\n const multiCursorDocument = new Doc();\n const multiCursorText = multiCursorDocument.getText(\"codemirror\");\n\n if (!userColor?.startsWith?.(\"#\")) {\n console.warn(\"user color must be hex!\");\n userColor = \"#30bced\";\n }\n const userColorLight = `${userColor.substring(0, 7)}33`;\n\n const provider = new WebsocketProvider(url, roomId, multiCursorDocument);\n provider.awareness.setLocalStateField(\"user\", {\n name: userName,\n color: userColor,\n colorLight: userColorLight,\n });\n\n if (opts.onChangeStatusProvider)\n provider.on(\"status\", (event: ProviderStatusEvent) => {\n opts.onChangeStatusProvider?.(event, provider, multiCursorText);\n });\n\n provider.on(\"sync\", (isSynced: boolean) => {\n if (opts.onSyncProvider) {\n opts.onSyncProvider(isSynced, provider, multiCursorText);\n }\n\n if (opts.autoInsert && isSynced && !multiCursorText.length && initialText) {\n multiCursorText.insert(0, initialText);\n }\n });\n\n return { provider, multiCursorText };\n}\n"],"names":[],"mappings":"AAMO,eAAe,kBAAkB,CAAC,EACvC,MAAM,EACN,GAAG,EACH,QAAQ,GAAG,WAAW,EACtB,SAAS,EACT,WAAW,EACX,GAAG,IAAI,EACmB,EAAA;IAC1B,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,OAAO,KAAK,CAAC;IACnC,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,OAAO,aAAa,CAAC;AAEzD,IAAA,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAE;IACrC,MAAM,eAAe,GAAG,mBAAmB,CAAC,OAAO,CAAC,YAAY,CAAC;IAEjE,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,CAAC,EAAE;AACjC,QAAA,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;QACvC,SAAS,GAAG,SAAS;;AAEvB,IAAA,MAAM,cAAc,GAAG,CAAG,EAAA,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,EAAA,CAAI;IAEvD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"init-editor-provider.js","sources":["../../../../../src/module/Editor/lib/init-editor-provider.ts"],"sourcesContent":["import type { MultiCursorOptions, ProviderStatusEvent } from \"../Editor.types\";\n\ntype InitEditorProviderOptions = {\n initialText?: string;\n} & MultiCursorOptions;\n\nexport async function initEditorProvider({\n roomId,\n url,\n userName = \"Anonymous\",\n userColor,\n initialText,\n ...opts\n}: InitEditorProviderOptions) {\n const { Doc } = await import(\"yjs\");\n const { WebsocketProvider } = await import(\"y-websocket\");\n\n const multiCursorDocument = new Doc();\n const multiCursorText = multiCursorDocument.getText(\"codemirror\");\n\n if (!userColor?.startsWith?.(\"#\")) {\n console.warn(\"user color must be hex!\");\n userColor = \"#30bced\";\n }\n const userColorLight = `${userColor.substring(0, 7)}33`;\n\n const provider = new WebsocketProvider(url, roomId, multiCursorDocument, {\n disableBc: opts.disableBc,\n });\n provider.awareness.setLocalStateField(\"user\", {\n name: userName,\n color: userColor,\n colorLight: userColorLight,\n });\n\n if (opts.onChangeStatusProvider)\n provider.on(\"status\", (event: ProviderStatusEvent) => {\n opts.onChangeStatusProvider?.(event, provider, multiCursorText);\n });\n\n provider.on(\"sync\", (isSynced: boolean) => {\n if (opts.onSyncProvider) {\n opts.onSyncProvider(isSynced, provider, multiCursorText);\n }\n\n if (opts.autoInsert && isSynced && !multiCursorText.length && initialText) {\n multiCursorText.insert(0, initialText);\n }\n });\n\n return { provider, multiCursorText };\n}\n"],"names":[],"mappings":"AAMO,eAAe,kBAAkB,CAAC,EACvC,MAAM,EACN,GAAG,EACH,QAAQ,GAAG,WAAW,EACtB,SAAS,EACT,WAAW,EACX,GAAG,IAAI,EACmB,EAAA;IAC1B,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,OAAO,KAAK,CAAC;IACnC,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,OAAO,aAAa,CAAC;AAEzD,IAAA,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAE;IACrC,MAAM,eAAe,GAAG,mBAAmB,CAAC,OAAO,CAAC,YAAY,CAAC;IAEjE,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,CAAC,EAAE;AACjC,QAAA,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;QACvC,SAAS,GAAG,SAAS;;AAEvB,IAAA,MAAM,cAAc,GAAG,CAAG,EAAA,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,EAAA,CAAI;IAEvD,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,mBAAmB,EAAE;QACvE,SAAS,EAAE,IAAI,CAAC,SAAS;AAC1B,KAAA,CAAC;AACF,IAAA,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE;AAC5C,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,UAAU,EAAE,cAAc;AAC3B,KAAA,CAAC;IAEF,IAAI,IAAI,CAAC,sBAAsB;QAC7B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAA0B,KAAI;YACnD,IAAI,CAAC,sBAAsB,GAAG,KAAK,EAAE,QAAQ,EAAE,eAAe,CAAC;AACjE,SAAC,CAAC;IAEJ,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,QAAiB,KAAI;AACxC,QAAA,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,CAAC;;AAG1D,QAAA,IAAI,IAAI,CAAC,UAAU,IAAI,QAAQ,IAAI,CAAC,eAAe,CAAC,MAAM,IAAI,WAAW,EAAE;AACzE,YAAA,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC;;AAE1C,KAAC,CAAC;AAEF,IAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE;AACtC;;;;"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KeyBinding, Decoration, EditorView as EditorView$1, ViewUpdate } from '@codemirror/view';
|
|
2
2
|
import { WebsocketProvider } from 'y-websocket';
|
|
3
3
|
import { Text } from 'yjs';
|
|
4
|
+
import * as _codemirror_state from '@codemirror/state';
|
|
5
|
+
import { Compartment, Range, Extension, EditorState as EditorState$1 } from '@codemirror/state';
|
|
4
6
|
import { autocompletion } from '@codemirror/autocomplete';
|
|
5
|
-
import { EditorState, Range } from '@codemirror/state';
|
|
6
7
|
import { LanguageDescription } from '@codemirror/language';
|
|
7
8
|
import { SyntaxNodeRef } from '@lezer/common';
|
|
8
9
|
|
|
10
|
+
declare const ReadonlyCompartment: Compartment;
|
|
11
|
+
declare const VimModeCompartment: Compartment;
|
|
12
|
+
declare const ThemeCompartment: Compartment;
|
|
13
|
+
|
|
14
|
+
type EditorAutoCompleteConfig = Omit<Exclude<Parameters<typeof autocompletion>[0], undefined>, "override">;
|
|
9
15
|
type InitAutoCompleteOptions = {
|
|
10
16
|
autoCompleteTagOptions?: string[];
|
|
11
|
-
autoCompleteConfig?:
|
|
17
|
+
autoCompleteConfig?: EditorAutoCompleteConfig;
|
|
12
18
|
};
|
|
13
19
|
|
|
14
20
|
type EditorTheme = "dark" | "light";
|
|
@@ -54,6 +60,10 @@ type HighlightConfig = {
|
|
|
54
60
|
regexp?: string;
|
|
55
61
|
};
|
|
56
62
|
|
|
63
|
+
declare function getDarkTheme({ dark }: InitThemeOptions): _codemirror_state.Extension[];
|
|
64
|
+
|
|
65
|
+
declare function getLightTheme({ light }: InitThemeOptions): _codemirror_state.Extension[];
|
|
66
|
+
|
|
57
67
|
type InitKeyMapsOptions = {
|
|
58
68
|
onEnter?: HandleEnterKeyMapEditorFunction;
|
|
59
69
|
onEscape?: HandleEscapeKeyMapEditorFunction;
|
|
@@ -71,7 +81,7 @@ type DefaultKeyMapsOptions = {
|
|
|
71
81
|
type GetChangeEventOptions = {
|
|
72
82
|
onChange?: HandleChangeEditorFunction;
|
|
73
83
|
};
|
|
74
|
-
type HandleChangeEditorFunction = (view:
|
|
84
|
+
type HandleChangeEditorFunction = (view: EditorViewUpdate) => void;
|
|
75
85
|
|
|
76
86
|
type GetFocusEventOptions = {
|
|
77
87
|
onFocus?: HandleFocusEditorFunction;
|
|
@@ -82,20 +92,21 @@ type HandleBlurEditorFunction = (state: EditorState) => void;
|
|
|
82
92
|
|
|
83
93
|
type InitListenersOptions = GetFocusEventOptions & GetChangeEventOptions;
|
|
84
94
|
|
|
95
|
+
type EditorLanguages = LanguageDescription;
|
|
85
96
|
type InitMarkdownOptions = {
|
|
86
|
-
languages?:
|
|
97
|
+
languages?: EditorLanguages[];
|
|
87
98
|
imageSrcGetter?: (src: string) => string;
|
|
88
99
|
};
|
|
89
100
|
type GetDecorationOptions = {
|
|
90
101
|
node: SyntaxNodeRef;
|
|
91
102
|
decorations: Range<Decoration>[];
|
|
92
|
-
view: EditorView;
|
|
103
|
+
view: EditorView$1;
|
|
93
104
|
settings: MarkdownDecorationSettings;
|
|
94
105
|
};
|
|
95
106
|
type GetSelectionDecorationOptions = {
|
|
96
107
|
node: SyntaxNodeRef;
|
|
97
108
|
decorations: Range<Decoration>[];
|
|
98
|
-
view: EditorView;
|
|
109
|
+
view: EditorView$1;
|
|
99
110
|
forceActive: boolean;
|
|
100
111
|
settings: MarkdownDecorationSettings;
|
|
101
112
|
};
|
|
@@ -119,7 +130,13 @@ type InitExtensionsOptions = {
|
|
|
119
130
|
multiCursorText: Text | undefined;
|
|
120
131
|
provider: WebsocketProvider | undefined;
|
|
121
132
|
} & ExtensionsOptions;
|
|
133
|
+
declare const initExtensions: ({ onBlur, onChange, onFocus, onEnter, onEscape, readonly, vimMode, multiCursorText, provider, theme, dark, light, languages, keyMaps, defaultKeyMaps, imageSrcGetter, autoCompleteTagOptions, autoCompleteConfig, }: InitExtensionsOptions) => Promise<Extension[]>;
|
|
122
134
|
|
|
135
|
+
type YWebsocketProvider = WebsocketProvider;
|
|
136
|
+
type YText = Text;
|
|
137
|
+
type EditorView = EditorView$1;
|
|
138
|
+
type EditorViewUpdate = ViewUpdate;
|
|
139
|
+
type EditorState = EditorState$1;
|
|
123
140
|
type EditorArguments = {
|
|
124
141
|
root: HTMLElement;
|
|
125
142
|
initialText?: string;
|
|
@@ -131,15 +148,16 @@ type MultiCursorOptions = {
|
|
|
131
148
|
userColor?: string;
|
|
132
149
|
roomId: string;
|
|
133
150
|
autoInsert?: boolean;
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
disableBc?: boolean;
|
|
152
|
+
onChangeStatusProvider?: (event: ProviderStatusEvent, provider: YWebsocketProvider, doc: YText) => void;
|
|
153
|
+
onSyncProvider?: (synced: boolean, provider: YWebsocketProvider, doc: YText) => void;
|
|
136
154
|
};
|
|
137
155
|
type ProviderStatusEvent = {
|
|
138
156
|
status?: "connected" | "disconnected" | "connecting";
|
|
139
157
|
};
|
|
140
158
|
|
|
141
159
|
declare class Editor {
|
|
142
|
-
view: EditorView | undefined;
|
|
160
|
+
view: EditorView$1 | undefined;
|
|
143
161
|
provider: WebsocketProvider | undefined;
|
|
144
162
|
arguments: EditorArguments;
|
|
145
163
|
yText: Text | undefined;
|
|
@@ -156,5 +174,5 @@ declare class Editor {
|
|
|
156
174
|
}
|
|
157
175
|
type EditorInterface = typeof Editor;
|
|
158
176
|
|
|
159
|
-
export { Editor };
|
|
160
|
-
export type { CustomKeyMap, DecorationPlugin, DefaultKeyMapsOptions, EditorArguments, EditorInterface, EditorTheme, ExtensionsOptions, GetChangeEventOptions, GetDecorationFunction, GetDecorationOptions, GetFocusEventOptions, GetSelectionDecorationFunction, GetSelectionDecorationOptions, HandleBlurEditorFunction, HandleChangeEditorFunction, HandleEnterKeyMapEditorFunction, HandleEscapeKeyMapEditorFunction, HandleFocusEditorFunction, HighlightConfig, InitExtensionsOptions, InitKeyMapsOptions, InitListenersOptions, InitMarkdownOptions, InitSettingsOptions, InitThemeOptions, MultiCursorOptions, ThemeConfig, ThemeOptions };
|
|
177
|
+
export { Editor, ReadonlyCompartment, ThemeCompartment, VimModeCompartment, getDarkTheme, getLightTheme, initExtensions };
|
|
178
|
+
export type { CustomKeyMap, DecorationPlugin, DefaultKeyMapsOptions, EditorArguments, EditorAutoCompleteConfig, EditorInterface, EditorLanguages, EditorState, EditorTheme, EditorView, EditorViewUpdate, ExtensionsOptions, GetChangeEventOptions, GetDecorationFunction, GetDecorationOptions, GetFocusEventOptions, GetSelectionDecorationFunction, GetSelectionDecorationOptions, HandleBlurEditorFunction, HandleChangeEditorFunction, HandleEnterKeyMapEditorFunction, HandleEscapeKeyMapEditorFunction, HandleFocusEditorFunction, HighlightConfig, InitAutoCompleteOptions, InitExtensionsOptions, InitKeyMapsOptions, InitListenersOptions, InitMarkdownOptions, InitSettingsOptions, InitThemeOptions, MultiCursorOptions, ProviderStatusEvent, ThemeConfig, ThemeOptions, YText, YWebsocketProvider };
|