rme 0.1.3 → 0.1.5
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/dist/index.d.ts +1 -2
- package/dist/index.mjs +10 -25
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -91,7 +91,6 @@ type EditorContext = ReactFrameworkOutput<Remirror.Extensions>;
|
|
|
91
91
|
|
|
92
92
|
type LoadLanguage = (lang: string) => Promise<LanguageSupport> | LanguageSupport | void;
|
|
93
93
|
|
|
94
|
-
declare const cmInstanceMap: Map<string, MfCodemirrorView>;
|
|
95
94
|
declare const changeTheme: (theme: CreateThemeOptions) => void;
|
|
96
95
|
declare const extractMatches: (view: EditorView) => any[];
|
|
97
96
|
type CreateCodemirrorOptions = {
|
|
@@ -521,4 +520,4 @@ declare const lightTheme: {
|
|
|
521
520
|
};
|
|
522
521
|
};
|
|
523
522
|
|
|
524
|
-
export { type CreateCodemirrorOptions, type CreateWysiwygDelegateOptions, type DocToString, Editor, type EditorChangeEventParams, type EditorChangeHandler, type EditorContext, type EditorDelegate, extensions as EditorExtensions, type EditorProps, type EditorRef, type EditorState, type EditorViewType, type HTMLAstNode, MfCodemirrorView, type Note, Preview, SourceCodeThemeWrapper, _default$1 as SourceEditor, type StringToDoc, ThemeProvider, _default as WysiwygEditor, WysiwygThemeWrapper, buildMarkdownParser, buildMarkdownSerializer, changeTheme,
|
|
523
|
+
export { type CreateCodemirrorOptions, type CreateWysiwygDelegateOptions, type DocToString, Editor, type EditorChangeEventParams, type EditorChangeHandler, type EditorContext, type EditorDelegate, extensions as EditorExtensions, type EditorProps, type EditorRef, type EditorState, type EditorViewType, type HTMLAstNode, MfCodemirrorView, type Note, Preview, SourceCodeThemeWrapper, _default$1 as SourceEditor, type StringToDoc, ThemeProvider, _default as WysiwygEditor, WysiwygThemeWrapper, buildMarkdownParser, buildMarkdownSerializer, changeTheme, common, computeChange, createSourceCodeDelegate, createSourceCodeManager, createWysiwygDelegate, darkTheme, defaultStyleToken, extractMatches, getLanguageMap, lightTheme, loadLanguage, tableSelectorSize, wysiwygTransformer };
|
package/dist/index.mjs
CHANGED
|
@@ -17788,7 +17788,6 @@ var ClipboardExtension = class extends PlainExtension7 {
|
|
|
17788
17788
|
if (html2.length === 0 && text.length === 0) return false;
|
|
17789
17789
|
const domParser = DOMParser2.fromSchema(schema);
|
|
17790
17790
|
let dom;
|
|
17791
|
-
console.log("text", text, html2);
|
|
17792
17791
|
if (text) {
|
|
17793
17792
|
const slice2 = parser4?.(text);
|
|
17794
17793
|
if (!slice2 || typeof slice2 === "string") return false;
|
|
@@ -17836,16 +17835,18 @@ var ClipboardExtension = class extends PlainExtension7 {
|
|
|
17836
17835
|
createCommands() {
|
|
17837
17836
|
return {
|
|
17838
17837
|
rmeParse: () => (props) => {
|
|
17838
|
+
console.log("rmeParse");
|
|
17839
17839
|
const { state, dispatch, view } = props;
|
|
17840
17840
|
if (!dispatch || !view) return false;
|
|
17841
|
-
console.log("rmeParse", state, view);
|
|
17842
17841
|
navigator.clipboard.readText().then((text) => {
|
|
17842
|
+
console.log("texttext", text);
|
|
17843
17843
|
const parser4 = wysiwygTransformer.stringToDoc;
|
|
17844
|
-
const tr = state.tr.replaceSelectionWith(
|
|
17845
|
-
state.schema.text(text)
|
|
17846
|
-
);
|
|
17847
17844
|
const slice = parser4?.(text);
|
|
17848
|
-
|
|
17845
|
+
console.log("slice", slice);
|
|
17846
|
+
if (!slice || typeof slice === "string") {
|
|
17847
|
+
view.dispatch(state.tr.replaceSelectionWith(state.schema.text(text)));
|
|
17848
|
+
return false;
|
|
17849
|
+
}
|
|
17849
17850
|
const res = [];
|
|
17850
17851
|
slice.content.forEach((node, index) => {
|
|
17851
17852
|
if (node.type.name === "paragraph" && index === 0) {
|
|
@@ -17856,6 +17857,7 @@ var ClipboardExtension = class extends PlainExtension7 {
|
|
|
17856
17857
|
res.push(node);
|
|
17857
17858
|
}
|
|
17858
17859
|
});
|
|
17860
|
+
console.log("res", res);
|
|
17859
17861
|
view.dispatch(view.state.tr.replaceSelectionWith(res, false));
|
|
17860
17862
|
return true;
|
|
17861
17863
|
});
|
|
@@ -18538,8 +18540,8 @@ import { cloneDeep as cloneDeep2 } from "lodash";
|
|
|
18538
18540
|
// src/editor/extensions/Shortcuts/configs/keymap.ts
|
|
18539
18541
|
var rmeDefaultKeymap = {
|
|
18540
18542
|
"mod-c": "copy",
|
|
18541
|
-
"mod-
|
|
18542
|
-
"mod-
|
|
18543
|
+
"mod-v": "rmeParse",
|
|
18544
|
+
"mod-x": "cut",
|
|
18543
18545
|
"mod-z": "undo",
|
|
18544
18546
|
"mod-y": "redo",
|
|
18545
18547
|
"mod-shift-z": "redo",
|
|
@@ -18579,16 +18581,6 @@ var ShortcutManager = class _ShortcutManager {
|
|
|
18579
18581
|
return true;
|
|
18580
18582
|
}
|
|
18581
18583
|
commands[command5](state, dispatch, view);
|
|
18582
|
-
if (view?.dom) {
|
|
18583
|
-
const cm = view.dom.querySelector(".cm-editor")?.CodeMirror;
|
|
18584
|
-
if (cm) {
|
|
18585
|
-
try {
|
|
18586
|
-
cm.execCommand(command5);
|
|
18587
|
-
} catch (e) {
|
|
18588
|
-
console.debug(`CodeMirror command not found: ${command5}`);
|
|
18589
|
-
}
|
|
18590
|
-
}
|
|
18591
|
-
}
|
|
18592
18584
|
return true;
|
|
18593
18585
|
};
|
|
18594
18586
|
}
|
|
@@ -18625,12 +18617,6 @@ var ShortcutsExtension = class extends PlainExtension8 {
|
|
|
18625
18617
|
const keyBinds = ShortcutManager.getInstance().createKeyBindings(this.store.commands, {
|
|
18626
18618
|
disableAllBuildInShortcuts: this.options.disableAllBuildInShortcuts
|
|
18627
18619
|
});
|
|
18628
|
-
cmInstanceMap.forEach((cm) => {
|
|
18629
|
-
const cmEditor = cm.cm;
|
|
18630
|
-
if (cmEditor) {
|
|
18631
|
-
console.log("cmEditor", cmEditor);
|
|
18632
|
-
}
|
|
18633
|
-
});
|
|
18634
18620
|
const newState = view.state.reconfigure({
|
|
18635
18621
|
plugins: [...view.state.plugins, keymap4(keyBinds)]
|
|
18636
18622
|
});
|
|
@@ -20270,7 +20256,6 @@ export {
|
|
|
20270
20256
|
buildMarkdownParser,
|
|
20271
20257
|
buildMarkdownSerializer,
|
|
20272
20258
|
changeTheme,
|
|
20273
|
-
cmInstanceMap,
|
|
20274
20259
|
common,
|
|
20275
20260
|
computeChange,
|
|
20276
20261
|
createSourceCodeDelegate,
|