@onereach/ui-components 4.1.1 → 4.2.0-beta.2545.0
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/bundled/v2/components/OrCode/OrCode.js +6 -3727
- package/dist/bundled/v2/components/OrCode/index.js +6 -2
- package/dist/bundled/v2/components/OrCode/lang.js +3897 -3
- package/dist/bundled/v2/components/OrCode/theme.js +2 -1
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +1 -0
- package/dist/bundled/v2/components/OrConfirm/index.js +1 -0
- package/dist/bundled/v2/components/OrModal/OrModal.js +3 -1266
- package/dist/bundled/v2/components/OrModal/index.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +1988 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +68 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +15 -2
- package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-c5a9adb7.js → v2/index-16aee5bc.js} +14 -234
- package/dist/bundled/v2/index-62c3221b.js +6956 -0
- package/dist/bundled/{v3/lang-02d2bb2d.js → v2/index-70ca38c5.js} +73 -3965
- package/dist/bundled/v2/{index-6976c52a.js → index-f5487f12.js} +3 -115
- package/dist/bundled/v2/index.es-3f39f316.js +115 -0
- package/dist/bundled/v2/index.js +18 -5
- package/dist/bundled/v2/markdown-516daba9.js +18737 -0
- package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/bundled/{v3/OrModal.vue_vue_type_script_lang-d5fb0b11.js → v2/useFocusTrap-9567b3c8.js} +3 -105
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-f6f74339.js +236 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-806d209b.js → OrConfirm.vue_vue_type_script_lang-36318ca2.js} +1 -1
- package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-af0c4288.js +107 -0
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-2bb9d87f.js +1765 -0
- package/dist/bundled/v3/components/OrCode/OrCode.js +10 -6
- package/dist/bundled/v3/components/OrCode/index.js +8 -4
- package/dist/bundled/v3/components/OrCode/lang.js +3897 -3
- package/dist/bundled/v3/components/OrCode/theme.js +2 -1
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +4 -3
- package/dist/bundled/v3/components/OrConfirm/index.js +3 -2
- package/dist/bundled/v3/components/OrModal/OrModal.js +3 -2
- package/dist/bundled/v3/components/OrModal/index.js +2 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +227 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +84 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +45 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +19 -5
- package/dist/bundled/v3/index-16aee5bc.js +3740 -0
- package/dist/bundled/v3/index-62c3221b.js +6956 -0
- package/dist/bundled/{v2/lang-02d2bb2d.js → v3/index-70ca38c5.js} +73 -3965
- package/dist/bundled/v3/{index-6976c52a.js → index-f5487f12.js} +3 -115
- package/dist/bundled/v3/index.es-3f39f316.js +115 -0
- package/dist/bundled/v3/index.js +23 -9
- package/dist/bundled/v3/markdown-516daba9.js +18737 -0
- package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +9360 -0
- package/dist/bundled/v3/useFocusTrap-9567b3c8.js +1268 -0
- package/dist/esm/v2/OrRichTextEditor-dfddef2b.js +722 -0
- package/dist/esm/v2/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +59 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v2/index.js +24 -0
- package/dist/esm/v3/OrRichTextEditor-f4ce18ef.js +686 -0
- package/dist/esm/v3/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +170 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +57 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v3/index.js +24 -0
- package/package.json +25 -5
- package/src/components/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +7 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +103 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +624 -0
- package/src/components/or-rich-text-editor-v3/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/styles.ts +64 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +254 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +213 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +117 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { Level } from '@tiptap/extension-heading';
|
|
3
|
+
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
|
+
editor: Editor | null;
|
|
5
|
+
editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
6
|
+
containerRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
7
|
+
toolbarButtonRef: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
8
|
+
[x: string]: ((...args: any[]) => any) | null;
|
|
9
|
+
} | string[], {} & {}, {
|
|
10
|
+
[x: number]: string;
|
|
11
|
+
} | {}, true> | undefined>;
|
|
12
|
+
menuRef: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
13
|
+
[x: string]: ((...args: any[]) => any) | null;
|
|
14
|
+
} | string[], {} & {}, {
|
|
15
|
+
[x: number]: string;
|
|
16
|
+
} | {}, true> | undefined>;
|
|
17
|
+
iconsEnum: import("@vue/composition-api").Ref<{
|
|
18
|
+
[x: string]: string;
|
|
19
|
+
}>;
|
|
20
|
+
handleToolbarClick: (item: string, level?: number) => void;
|
|
21
|
+
handleEditorClick: () => void;
|
|
22
|
+
isActive: import("@vue/composition-api").Ref<{
|
|
23
|
+
[x: string]: boolean;
|
|
24
|
+
}>;
|
|
25
|
+
iconTooltipsEnum: import("@vue/composition-api").Ref<{
|
|
26
|
+
[x: string]: string;
|
|
27
|
+
}>;
|
|
28
|
+
containerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
29
|
+
toolbarContainerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
30
|
+
toolbarStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
31
|
+
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
32
|
+
root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
33
|
+
editorInputStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
34
|
+
getIndexOfHeading: import("@vue/composition-api").ComputedRef<number>;
|
|
35
|
+
headingLevels: Level[];
|
|
36
|
+
headingIcon: import("@vue/composition-api").ComputedRef<string>;
|
|
37
|
+
attachLink: () => Promise<void>;
|
|
38
|
+
discardLink: () => void;
|
|
39
|
+
isOpenLinkModal: import("@vue/composition-api").Ref<boolean>;
|
|
40
|
+
text: import("@vue/composition-api").Ref<string>;
|
|
41
|
+
link: import("@vue/composition-api").Ref<string>;
|
|
42
|
+
isFocused: import("@vue/composition-api").Ref<boolean>;
|
|
43
|
+
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
44
|
+
modelValue: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
toolbar: {
|
|
49
|
+
type: ArrayConstructor;
|
|
50
|
+
default: () => never[];
|
|
51
|
+
};
|
|
52
|
+
description: {
|
|
53
|
+
type: StringConstructor;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
placeholder: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
autofocus: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
markdownFormat: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
fullHeight: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
73
|
+
modelValue: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
toolbar: {
|
|
78
|
+
type: ArrayConstructor;
|
|
79
|
+
default: () => never[];
|
|
80
|
+
};
|
|
81
|
+
description: {
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
default: string;
|
|
84
|
+
};
|
|
85
|
+
placeholder: {
|
|
86
|
+
type: StringConstructor;
|
|
87
|
+
default: string;
|
|
88
|
+
};
|
|
89
|
+
autofocus: {
|
|
90
|
+
type: BooleanConstructor;
|
|
91
|
+
default: boolean;
|
|
92
|
+
};
|
|
93
|
+
markdownFormat: {
|
|
94
|
+
type: BooleanConstructor;
|
|
95
|
+
default: boolean;
|
|
96
|
+
};
|
|
97
|
+
fullHeight: {
|
|
98
|
+
type: BooleanConstructor;
|
|
99
|
+
default: boolean;
|
|
100
|
+
};
|
|
101
|
+
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
102
|
+
modelValue: string;
|
|
103
|
+
toolbar: unknown[];
|
|
104
|
+
description: string;
|
|
105
|
+
placeholder: string;
|
|
106
|
+
autofocus: boolean;
|
|
107
|
+
markdownFormat: boolean;
|
|
108
|
+
fullHeight: boolean;
|
|
109
|
+
} & {} & {
|
|
110
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
111
|
+
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
112
|
+
editor: Editor | null;
|
|
113
|
+
editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
114
|
+
containerRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
115
|
+
toolbarButtonRef: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
116
|
+
[x: string]: ((...args: any[]) => any) | null;
|
|
117
|
+
} | string[], {} & {}, {
|
|
118
|
+
[x: number]: string;
|
|
119
|
+
} | {}, true> | undefined>;
|
|
120
|
+
menuRef: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
121
|
+
[x: string]: ((...args: any[]) => any) | null;
|
|
122
|
+
} | string[], {} & {}, {
|
|
123
|
+
[x: number]: string;
|
|
124
|
+
} | {}, true> | undefined>;
|
|
125
|
+
iconsEnum: import("@vue/composition-api").Ref<{
|
|
126
|
+
[x: string]: string;
|
|
127
|
+
}>;
|
|
128
|
+
handleToolbarClick: (item: string, level?: number) => void;
|
|
129
|
+
handleEditorClick: () => void;
|
|
130
|
+
isActive: import("@vue/composition-api").Ref<{
|
|
131
|
+
[x: string]: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
iconTooltipsEnum: import("@vue/composition-api").Ref<{
|
|
134
|
+
[x: string]: string;
|
|
135
|
+
}>;
|
|
136
|
+
containerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
137
|
+
toolbarContainerStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
138
|
+
toolbarStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
139
|
+
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
140
|
+
root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
141
|
+
editorInputStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
142
|
+
getIndexOfHeading: import("@vue/composition-api").ComputedRef<number>;
|
|
143
|
+
headingLevels: Level[];
|
|
144
|
+
headingIcon: import("@vue/composition-api").ComputedRef<string>;
|
|
145
|
+
attachLink: () => Promise<void>;
|
|
146
|
+
discardLink: () => void;
|
|
147
|
+
isOpenLinkModal: import("@vue/composition-api").Ref<boolean>;
|
|
148
|
+
text: import("@vue/composition-api").Ref<string>;
|
|
149
|
+
link: import("@vue/composition-api").Ref<string>;
|
|
150
|
+
isFocused: import("@vue/composition-api").Ref<boolean>;
|
|
151
|
+
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
152
|
+
modelValue: string;
|
|
153
|
+
toolbar: unknown[];
|
|
154
|
+
description: string;
|
|
155
|
+
placeholder: string;
|
|
156
|
+
autofocus: boolean;
|
|
157
|
+
markdownFormat: boolean;
|
|
158
|
+
fullHeight: boolean;
|
|
159
|
+
} & {} & {
|
|
160
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
161
|
+
}, {
|
|
162
|
+
modelValue: string;
|
|
163
|
+
toolbar: unknown[];
|
|
164
|
+
description: string;
|
|
165
|
+
placeholder: string;
|
|
166
|
+
autofocus: boolean;
|
|
167
|
+
markdownFormat: boolean;
|
|
168
|
+
fullHeight: boolean;
|
|
169
|
+
}, true>);
|
|
170
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OrRichTextEditorV3 } from './OrRichTextEditor.vue';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export { default as OrRichTextEditorV3 } from './OrRichTextEditor.js';
|
|
2
|
+
import 'vue-demi';
|
|
3
|
+
import '../../useFocusTrap-9567b3c8.js';
|
|
4
|
+
import '@vueuse/core';
|
|
5
|
+
import '../../markdown-516daba9.js';
|
|
6
|
+
import '../../index-62c3221b.js';
|
|
7
|
+
import 'node:punycode';
|
|
8
|
+
import '../../tiptap-core.esm-f85402b1.js';
|
|
9
|
+
import '../../index.es-3f39f316.js';
|
|
10
|
+
import './styles.js';
|
|
11
|
+
import './utils/codemirror/codemirrorNode.js';
|
|
12
|
+
import './utils/codemirror/codemirrorView.js';
|
|
13
|
+
import '../../index-f5487f12.js';
|
|
14
|
+
import './utils/codemirror/theme.js';
|
|
15
|
+
import '../../index-16aee5bc.js';
|
|
16
|
+
import '../../index-70ca38c5.js';
|
|
17
|
+
import '../OrIconButtonV3/OrIconButton.js';
|
|
18
|
+
import '../OrIconButtonV3/props.js';
|
|
19
|
+
import '../OrIconV3/props.js';
|
|
20
|
+
import '../OrIconButtonV3/styles.js';
|
|
21
|
+
import '../OrIconV3/OrIcon.js';
|
|
22
|
+
import '../OrIconV3/styles.js';
|
|
23
|
+
import '../../normalize-component-6e8e3d80.js';
|
|
24
|
+
import '../OrTooltipV3/OrTooltip.js';
|
|
25
|
+
import '../OrTooltipV3/styles.js';
|
|
26
|
+
import '../OrPopoverV3/OrPopover.js';
|
|
27
|
+
import '../../floating-ui.dom.esm-83eba816.js';
|
|
28
|
+
import '../OrPopoverV3/props.js';
|
|
29
|
+
import '../OrPopoverV3/styles.js';
|
|
30
|
+
import '../OrBottomSheetV3/OrBottomSheet.js';
|
|
31
|
+
import '../OrBottomSheetV3/styles.js';
|
|
32
|
+
import '../OrOverlayV3/OrOverlay.js';
|
|
33
|
+
import '../OrOverlayV3/styles.js';
|
|
34
|
+
import '../OrTeleportV3/OrTeleport.js';
|
|
35
|
+
import 'portal-vue';
|
|
36
|
+
import '../../hooks/useElevation.js';
|
|
37
|
+
import '../../utils/isVisible.js';
|
|
38
|
+
import '../../hooks/useResponsive/useResponsive.js';
|
|
39
|
+
import '../OrLabelV3/OrLabel.js';
|
|
40
|
+
import '../OrLabelV3/props.js';
|
|
41
|
+
import '../OrLabelV3/styles.js';
|
|
42
|
+
import '../OrMenuItemV3/OrMenuItem.js';
|
|
43
|
+
import '../OrMenuItemV3/styles.js';
|
|
44
|
+
import '../OrMenuV3/OrMenu.js';
|
|
45
|
+
import '../OrMenuV3/styles.js';
|
|
46
|
+
import '../OrModalV3/OrModal.js';
|
|
47
|
+
import '../OrModalV3/props.js';
|
|
48
|
+
import '../OrModalV3/styles.js';
|
|
49
|
+
import '../OrInputV3/OrInput.js';
|
|
50
|
+
import '../OrInputV3/props.js';
|
|
51
|
+
import '../OrInputBoxV3/props.js';
|
|
52
|
+
import '../OrInputV3/styles.js';
|
|
53
|
+
import '../OrErrorV3/OrError.js';
|
|
54
|
+
import '../OrErrorV3/styles.js';
|
|
55
|
+
import '../OrHintV3/OrHint.js';
|
|
56
|
+
import '../OrHintV3/styles.js';
|
|
57
|
+
import '../OrInputBoxV3/OrInputBox.js';
|
|
58
|
+
import '../OrInputBoxV3/styles.js';
|
|
59
|
+
import '../OrLoaderV3/OrLoader.js';
|
|
60
|
+
import '../OrLoaderV3/props.js';
|
|
61
|
+
import '../OrLoaderV3/styles.js';
|
|
62
|
+
import '../../hooks/useIdAttribute.js';
|
|
63
|
+
import '../../hooks/useControlAttributes.js';
|
|
64
|
+
import '../../hooks/useValidationAttributes.js';
|
|
65
|
+
import '../../style-inject.es-4c6f2515.js';
|
|
66
|
+
import '../OrButtonV3/OrButton.js';
|
|
67
|
+
import '../OrButtonV3/props.js';
|
|
68
|
+
import '../OrButtonV3/styles.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const EditorContainer: string[];
|
|
2
|
+
export declare const ToolbarContainer: string[];
|
|
3
|
+
export declare const Toolbar: string[];
|
|
4
|
+
export declare const ToolbarButton: string[];
|
|
5
|
+
export declare const ToolbarButtonFocused: string[];
|
|
6
|
+
export declare const EditorInput: string[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const EditorContainer = [
|
|
2
|
+
// Colors
|
|
3
|
+
'border-outline', 'dark:border-outline-dark', 'focus-within:theme-border-1-primary', 'dark:focus-within:theme-border-1-primary-dark', 'focus-within:bg-primary-opacity-0-08', 'dark:focus-within:bg-primary-opacity-0-08-dark', 'focus-within:theme-outline-primary', 'dark:focus-within:theme-outline-primary-dark',
|
|
4
|
+
// Sizing
|
|
5
|
+
'border-1', 'rounded-md', 'w-full'];
|
|
6
|
+
const ToolbarContainer = [
|
|
7
|
+
// Layout
|
|
8
|
+
'flex',
|
|
9
|
+
//Spacing
|
|
10
|
+
'py-sm',
|
|
11
|
+
//Sizing
|
|
12
|
+
'border-b-1',
|
|
13
|
+
//Colors
|
|
14
|
+
'border-b-outline', 'dark:border-b-outline-dark'];
|
|
15
|
+
const Toolbar = [
|
|
16
|
+
// Layout
|
|
17
|
+
'flex',
|
|
18
|
+
// Spacing
|
|
19
|
+
'px-sm', 'gap-md',
|
|
20
|
+
// Sizing
|
|
21
|
+
'border-r-1',
|
|
22
|
+
//Colors
|
|
23
|
+
'border-r-disabled', 'dark:border-r-outline-dark',
|
|
24
|
+
// Last child
|
|
25
|
+
'last-of-type:border-none'];
|
|
26
|
+
const ToolbarButton = [
|
|
27
|
+
// Typography
|
|
28
|
+
'text-on-disabled', 'dark:text-on-disabled-dark'];
|
|
29
|
+
const ToolbarButtonFocused = [
|
|
30
|
+
// Typography
|
|
31
|
+
'text-outline', 'dark:text-outline-dark'];
|
|
32
|
+
const EditorInput = [
|
|
33
|
+
// Typography
|
|
34
|
+
'typography-body-2-regular', 'text-on-background', 'dark:text-on-background-dark',
|
|
35
|
+
// Sizing
|
|
36
|
+
'min-h-[88px]'];
|
|
37
|
+
|
|
38
|
+
export { EditorContainer, EditorInput, Toolbar, ToolbarButton, ToolbarButtonFocused, ToolbarContainer };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { N as Node } from '../../../../tiptap-core.esm-f85402b1.js';
|
|
2
|
+
import CodeMirrorView from './codemirrorView.js';
|
|
3
|
+
import { m as minimalSetup } from '../../../../index-16aee5bc.js';
|
|
4
|
+
import { e as javascript } from '../../../../index-70ca38c5.js';
|
|
5
|
+
import '../../../../index-62c3221b.js';
|
|
6
|
+
import '../../../../index.es-3f39f316.js';
|
|
7
|
+
import '../../../../index-f5487f12.js';
|
|
8
|
+
import './theme.js';
|
|
9
|
+
|
|
10
|
+
var codemirrorNode = Node.create({
|
|
11
|
+
name: 'codeBlock',
|
|
12
|
+
content: 'text*',
|
|
13
|
+
marks: '',
|
|
14
|
+
group: 'block',
|
|
15
|
+
code: true,
|
|
16
|
+
defining: true,
|
|
17
|
+
isolating: true,
|
|
18
|
+
parseHTML() {
|
|
19
|
+
return [{
|
|
20
|
+
tag: 'pre',
|
|
21
|
+
preserveWhitespace: 'full'
|
|
22
|
+
}];
|
|
23
|
+
},
|
|
24
|
+
renderHTML() {
|
|
25
|
+
return ['pre', ['code', 0]];
|
|
26
|
+
},
|
|
27
|
+
addNodeView() {
|
|
28
|
+
return ({
|
|
29
|
+
node,
|
|
30
|
+
editor,
|
|
31
|
+
getPos
|
|
32
|
+
}) => {
|
|
33
|
+
return new CodeMirrorView({
|
|
34
|
+
node,
|
|
35
|
+
view: editor.view,
|
|
36
|
+
getPos: getPos,
|
|
37
|
+
cmOptions: {
|
|
38
|
+
extensions: [minimalSetup, javascript()]
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export { codemirrorNode as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TextSelection } from 'prosemirror-state';
|
|
2
|
+
import { EditorView, NodeView } from 'prosemirror-view';
|
|
3
|
+
import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
4
|
+
import { Transaction as CMTransaction } from '@codemirror/state';
|
|
5
|
+
import { Command, EditorView as CMView } from '@codemirror/view';
|
|
6
|
+
import { CodeMirrorViewOptions } from './types';
|
|
7
|
+
declare class CodeMirrorView implements NodeView {
|
|
8
|
+
name: string;
|
|
9
|
+
node: ProsemirrorNode;
|
|
10
|
+
view: EditorView;
|
|
11
|
+
dom: HTMLElement;
|
|
12
|
+
cm: CMView;
|
|
13
|
+
getPos: () => number;
|
|
14
|
+
updating: boolean;
|
|
15
|
+
constructor(options: CodeMirrorViewOptions);
|
|
16
|
+
forwardSelection(): void;
|
|
17
|
+
asProseMirrorSelection(doc: ProsemirrorNode): TextSelection;
|
|
18
|
+
dispatch(cmTr: CMTransaction): void;
|
|
19
|
+
mayBeEscape(unit: 'char' | 'line', dir: -1 | 1): Command;
|
|
20
|
+
update(node: ProsemirrorNode): boolean;
|
|
21
|
+
setSelection(anchor: number, head: number): void;
|
|
22
|
+
focus(): void;
|
|
23
|
+
selectNode(): void;
|
|
24
|
+
stopEvent(): boolean;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
export default CodeMirrorView;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { n as exitCode, T as TextSelection, S as Selection } from '../../../../index-62c3221b.js';
|
|
2
|
+
import { a as EditorState, E as EditorView, Y as highlightActiveLine, B as highlightActiveLineGutter, z as lineNumbers, k as keymap } from '../../../../index-f5487f12.js';
|
|
3
|
+
import theme from './theme.js';
|
|
4
|
+
import '../../../../index.es-3f39f316.js';
|
|
5
|
+
|
|
6
|
+
const computeChange = (oldVal, newVal) => {
|
|
7
|
+
if (oldVal === newVal) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
let start = 0;
|
|
11
|
+
let oldEnd = oldVal.length;
|
|
12
|
+
let newEnd = newVal.length;
|
|
13
|
+
while (start < oldEnd && oldVal.charCodeAt(start) === newVal.charCodeAt(start)) {
|
|
14
|
+
start += 1;
|
|
15
|
+
}
|
|
16
|
+
while (oldEnd > start && newEnd > start && oldVal.charCodeAt(oldEnd - 1) === newVal.charCodeAt(newEnd - 1)) {
|
|
17
|
+
oldEnd -= 1;
|
|
18
|
+
newEnd -= 1;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
from: start,
|
|
22
|
+
to: oldEnd,
|
|
23
|
+
text: newVal.slice(start, newEnd)
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
class CodeMirrorView {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
var _a;
|
|
29
|
+
this.updating = false;
|
|
30
|
+
// Store for later
|
|
31
|
+
this.node = options.node;
|
|
32
|
+
this.view = options.view;
|
|
33
|
+
const cmExtensions = ((_a = options.cmOptions) === null || _a === void 0 ? void 0 : _a.extensions) || [];
|
|
34
|
+
this.name = 'codeBlock', this.getPos = options.getPos;
|
|
35
|
+
const changeFilter = EditorState.changeFilter.of(tr => {
|
|
36
|
+
if (!tr.docChanged && !this.updating) {
|
|
37
|
+
this.forwardSelection();
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
});
|
|
41
|
+
// Create a CodeMirror instancew
|
|
42
|
+
this.cm = new EditorView({
|
|
43
|
+
dispatch: this.dispatch.bind(this)
|
|
44
|
+
});
|
|
45
|
+
// The editor's outer node is our DOM representation
|
|
46
|
+
this.dom = this.cm.dom;
|
|
47
|
+
const cmState = EditorState.create({
|
|
48
|
+
doc: this.node.textContent,
|
|
49
|
+
extensions: [theme, changeFilter, highlightActiveLine(), highlightActiveLineGutter(), lineNumbers(), keymap.of([{
|
|
50
|
+
key: 'ArrowUp',
|
|
51
|
+
run: this.mayBeEscape('line', -1)
|
|
52
|
+
}, {
|
|
53
|
+
key: 'ArrowLeft',
|
|
54
|
+
run: this.mayBeEscape('char', -1)
|
|
55
|
+
}, {
|
|
56
|
+
key: 'ArrowDown',
|
|
57
|
+
run: this.mayBeEscape('line', 1)
|
|
58
|
+
}, {
|
|
59
|
+
key: 'ArrowRight',
|
|
60
|
+
run: this.mayBeEscape('char', 1)
|
|
61
|
+
}, {
|
|
62
|
+
key: 'Ctrl-Enter',
|
|
63
|
+
run: () => {
|
|
64
|
+
if (exitCode(this.view.state, this.view.dispatch)) {
|
|
65
|
+
this.view.focus();
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}]), cmExtensions]
|
|
71
|
+
});
|
|
72
|
+
this.cm.setState(cmState);
|
|
73
|
+
}
|
|
74
|
+
forwardSelection() {
|
|
75
|
+
if (!this.cm.hasFocus) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const {
|
|
79
|
+
state
|
|
80
|
+
} = this.view;
|
|
81
|
+
const selection = this.asProseMirrorSelection(state.doc);
|
|
82
|
+
if (!selection.eq(state.selection)) {
|
|
83
|
+
this.view.dispatch(state.tr.setSelection(selection));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
asProseMirrorSelection(doc) {
|
|
87
|
+
const offset = this.getPos() + 1;
|
|
88
|
+
const {
|
|
89
|
+
anchor,
|
|
90
|
+
head
|
|
91
|
+
} = this.cm.state.selection.main;
|
|
92
|
+
return TextSelection.create(doc, anchor + offset, head + offset);
|
|
93
|
+
}
|
|
94
|
+
dispatch(cmTr) {
|
|
95
|
+
this.cm.setState(cmTr.state);
|
|
96
|
+
if (cmTr.docChanged && !this.updating) {
|
|
97
|
+
const start = this.getPos() + 1;
|
|
98
|
+
const cmValue = cmTr.state.doc.toString();
|
|
99
|
+
const change = computeChange(this.node.textContent, cmValue);
|
|
100
|
+
if (!change) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const content = change.text ? this.view.state.schema.text(change.text) : null;
|
|
104
|
+
const tr = this.view.state.tr.replaceWith(change.from + start, change.to + start, content);
|
|
105
|
+
this.view.dispatch(tr);
|
|
106
|
+
this.forwardSelection();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
mayBeEscape(unit, dir) {
|
|
110
|
+
return view => {
|
|
111
|
+
const {
|
|
112
|
+
state
|
|
113
|
+
} = view;
|
|
114
|
+
const {
|
|
115
|
+
selection
|
|
116
|
+
} = state;
|
|
117
|
+
const offsetToPos = () => {
|
|
118
|
+
const offset = selection.main.from;
|
|
119
|
+
const line = state.doc.lineAt(offset);
|
|
120
|
+
return {
|
|
121
|
+
line: line.number,
|
|
122
|
+
ch: offset - line.from
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const pos = offsetToPos();
|
|
126
|
+
const hasSelection = state.selection.ranges.some(r => !r.empty);
|
|
127
|
+
const firstLine = 1;
|
|
128
|
+
const lastLine = state.doc.lineAt(state.doc.length).number;
|
|
129
|
+
if (hasSelection || pos.line !== (dir < 0 ? firstLine : lastLine) || unit === 'char' && pos.ch !== (dir < 0 ? 0 : state.doc.line(pos.line).length)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const targetPos = this.getPos() + (dir < 0 ? 0 : this.node.nodeSize);
|
|
133
|
+
const pmSelection = Selection.near(this.view.state.doc.resolve(targetPos), dir);
|
|
134
|
+
this.view.dispatch(this.view.state.tr.setSelection(pmSelection).scrollIntoView());
|
|
135
|
+
this.view.focus();
|
|
136
|
+
return true;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
update(node) {
|
|
140
|
+
if (node.type !== this.node.type) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
this.node = node;
|
|
144
|
+
const change = computeChange(this.cm.state.doc.toString(), node.textContent);
|
|
145
|
+
if (change) {
|
|
146
|
+
this.updating = true;
|
|
147
|
+
this.cm.dispatch({
|
|
148
|
+
changes: {
|
|
149
|
+
from: change.from,
|
|
150
|
+
to: change.to,
|
|
151
|
+
insert: change.text
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
this.updating = false;
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
setSelection(anchor, head) {
|
|
159
|
+
this.focus();
|
|
160
|
+
this.updating = true;
|
|
161
|
+
this.cm.dispatch({
|
|
162
|
+
selection: {
|
|
163
|
+
anchor,
|
|
164
|
+
head
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
this.updating = false;
|
|
168
|
+
}
|
|
169
|
+
focus() {
|
|
170
|
+
this.cm.focus();
|
|
171
|
+
this.forwardSelection();
|
|
172
|
+
}
|
|
173
|
+
selectNode() {
|
|
174
|
+
this.focus();
|
|
175
|
+
}
|
|
176
|
+
stopEvent() {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
destroy() {
|
|
180
|
+
this.cm.destroy();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export { CodeMirrorView as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CodeMirrorView } from './codemirrorView';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Extension } from '@codemirror/state';
|
|
2
|
+
import { HighlightStyle } from '@codemirror/language';
|
|
3
|
+
export declare const color: {
|
|
4
|
+
chalky: string;
|
|
5
|
+
coral: string;
|
|
6
|
+
cyan: string;
|
|
7
|
+
invalid: string;
|
|
8
|
+
ivory: string;
|
|
9
|
+
stone: string;
|
|
10
|
+
malibu: string;
|
|
11
|
+
sage: string;
|
|
12
|
+
whiskey: string;
|
|
13
|
+
violet: string;
|
|
14
|
+
darkBackground: string;
|
|
15
|
+
highlightBackground: string;
|
|
16
|
+
background: string;
|
|
17
|
+
tooltipBackground: string;
|
|
18
|
+
selection: string;
|
|
19
|
+
cursor: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const orCodeTheme: Extension;
|
|
22
|
+
export declare const orCodeHighlightStyle: HighlightStyle;
|
|
23
|
+
declare const theme: Extension;
|
|
24
|
+
export default theme;
|