rme 0.1.7 → 0.1.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/dist/index.d.ts +7 -2
- package/dist/index.mjs +24 -8
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -77,7 +77,11 @@ interface Note {
|
|
|
77
77
|
content: string;
|
|
78
78
|
deleted: boolean;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
declare enum EditorViewType {
|
|
81
|
+
WYSIWYG = "wysiwyg",
|
|
82
|
+
SOURCECODE = "sourceCode",
|
|
83
|
+
PREVIEW = "preview"
|
|
84
|
+
}
|
|
81
85
|
type BaseEditorState = {
|
|
82
86
|
mode: EditorViewType;
|
|
83
87
|
delegate?: EditorDelegate;
|
|
@@ -144,6 +148,7 @@ declare function computeChange(oldVal: string, newVal: string): {
|
|
|
144
148
|
} | null;
|
|
145
149
|
|
|
146
150
|
type CreateSourceCodeManagerOptions = {
|
|
151
|
+
language?: string;
|
|
147
152
|
onCodemirrorViewLoad: (cm: MfCodemirrorView) => void;
|
|
148
153
|
};
|
|
149
154
|
declare function createSourceCodeManager(options?: CreateSourceCodeManagerOptions): RemirrorManager$1<any>;
|
|
@@ -516,4 +521,4 @@ declare const lightTheme: {
|
|
|
516
521
|
};
|
|
517
522
|
};
|
|
518
523
|
|
|
519
|
-
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,
|
|
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, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -19072,7 +19072,7 @@ var createSourceCodeDelegate = (options) => {
|
|
|
19072
19072
|
const manager = createSourceCodeManager(options);
|
|
19073
19073
|
const stringToDoc = (content) => {
|
|
19074
19074
|
const schema = manager.schema;
|
|
19075
|
-
const attrs = { language: "markdown" };
|
|
19075
|
+
const attrs = { language: options?.language || "markdown" };
|
|
19076
19076
|
const child = content ? schema.text(content) : void 0;
|
|
19077
19077
|
return schema.nodes.doc.create({}, schema.nodes.codeMirror.create(attrs, child));
|
|
19078
19078
|
};
|
|
@@ -19876,12 +19876,14 @@ var WysiwygEditor = (props) => {
|
|
|
19876
19876
|
);
|
|
19877
19877
|
useEffect6(() => {
|
|
19878
19878
|
const ext = editorDelegate.manager.getExtension(TransformerExtension);
|
|
19879
|
-
|
|
19880
|
-
editorDelegate
|
|
19881
|
-
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
|
|
19879
|
+
if (ext) {
|
|
19880
|
+
editorDelegate?.manager?.view?.dispatch(
|
|
19881
|
+
editorDelegate.manager.view.state.tr.setMeta(ext.pluginKey, {
|
|
19882
|
+
stringToDoc: editorDelegate.stringToDoc,
|
|
19883
|
+
docToString: editorDelegate.docToString
|
|
19884
|
+
})
|
|
19885
|
+
);
|
|
19886
|
+
}
|
|
19885
19887
|
}, [editorDelegate]);
|
|
19886
19888
|
let initialContent;
|
|
19887
19889
|
try {
|
|
@@ -19931,7 +19933,12 @@ import { nanoid as nanoid3 } from "nanoid";
|
|
|
19931
19933
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
19932
19934
|
var Editor = memo6(
|
|
19933
19935
|
forwardRef2((props, ref) => {
|
|
19934
|
-
const {
|
|
19936
|
+
const {
|
|
19937
|
+
initialType = "wysiwyg" /* WYSIWYG */,
|
|
19938
|
+
hooks = [],
|
|
19939
|
+
onContextMounted,
|
|
19940
|
+
...otherProps
|
|
19941
|
+
} = props;
|
|
19935
19942
|
const [type, setType] = useState8(initialType);
|
|
19936
19943
|
useImperativeHandle2(ref, () => ({
|
|
19937
19944
|
getType: () => type,
|
|
@@ -20073,6 +20080,14 @@ var SourceEditor_default = memo7(SourceEditor);
|
|
|
20073
20080
|
// src/editor/hooks/index.ts
|
|
20074
20081
|
import { useHelpers, useKeymap, useRemirrorContext as useRemirrorContext4, useCommands as useCommands4 } from "@remirror/react";
|
|
20075
20082
|
|
|
20083
|
+
// src/editor/types/index.ts
|
|
20084
|
+
var EditorViewType = /* @__PURE__ */ ((EditorViewType2) => {
|
|
20085
|
+
EditorViewType2["WYSIWYG"] = "wysiwyg";
|
|
20086
|
+
EditorViewType2["SOURCECODE"] = "sourceCode";
|
|
20087
|
+
EditorViewType2["PREVIEW"] = "preview";
|
|
20088
|
+
return EditorViewType2;
|
|
20089
|
+
})(EditorViewType || {});
|
|
20090
|
+
|
|
20076
20091
|
// src/editor/components/ThemeProvider.tsx
|
|
20077
20092
|
import { ThemeProvider as ScThemeProvider } from "styled-components";
|
|
20078
20093
|
import { memo as memo8, useEffect as useEffect8 } from "react";
|
|
@@ -20261,6 +20276,7 @@ var Preview = (props) => {
|
|
|
20261
20276
|
export {
|
|
20262
20277
|
Editor,
|
|
20263
20278
|
extensions_default as EditorExtensions,
|
|
20279
|
+
EditorViewType,
|
|
20264
20280
|
MfCodemirrorView,
|
|
20265
20281
|
Preview,
|
|
20266
20282
|
SourceCodeThemeWrapper,
|