orion-design 0.1.46 → 0.1.47
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +13 -0
- package/dist/components/RichTextEditor/index.d.ts +9 -0
- package/dist/components/RichTextEditor/index.js +25 -22
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +1 -1
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
@@ -17,6 +17,10 @@ export declare const richTextEditorProps: () => {
|
|
17
17
|
href?: string;
|
18
18
|
} | null | false;
|
19
19
|
};
|
20
|
+
placeholder: {
|
21
|
+
type: PropType<"请输入内容...">;
|
22
|
+
default: "请输入内容...";
|
23
|
+
};
|
20
24
|
};
|
21
25
|
export type RichTextEditorProps = Partial<ExtractPropTypes<ReturnType<typeof richTextEditorProps>>>;
|
22
26
|
declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
@@ -37,6 +41,10 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
37
41
|
href?: string;
|
38
42
|
} | null | false;
|
39
43
|
};
|
44
|
+
placeholder: {
|
45
|
+
type: PropType<"请输入内容...">;
|
46
|
+
default: "请输入内容...";
|
47
|
+
};
|
40
48
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import('vue').PublicProps, Readonly<ExtractPropTypes<{
|
41
49
|
modelValue: StringConstructor;
|
42
50
|
readonly: {
|
@@ -55,9 +63,14 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
55
63
|
href?: string;
|
56
64
|
} | null | false;
|
57
65
|
};
|
66
|
+
placeholder: {
|
67
|
+
type: PropType<"请输入内容...">;
|
68
|
+
default: "请输入内容...";
|
69
|
+
};
|
58
70
|
}>> & Readonly<{
|
59
71
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
60
72
|
}>, {
|
73
|
+
placeholder: "请输入内容...";
|
61
74
|
readonly: boolean;
|
62
75
|
uploadImage: (file: File) => {
|
63
76
|
url: string;
|
@@ -17,6 +17,10 @@ declare const _default: import('../_util').SFCWithInstall<import('vue').DefineCo
|
|
17
17
|
href?: string;
|
18
18
|
} | null | false;
|
19
19
|
};
|
20
|
+
placeholder: {
|
21
|
+
type: import('vue').PropType<"请输入内容...">;
|
22
|
+
default: "请输入内容...";
|
23
|
+
};
|
20
24
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
21
25
|
modelValue: StringConstructor;
|
22
26
|
readonly: {
|
@@ -35,9 +39,14 @@ declare const _default: import('../_util').SFCWithInstall<import('vue').DefineCo
|
|
35
39
|
href?: string;
|
36
40
|
} | null | false;
|
37
41
|
};
|
42
|
+
placeholder: {
|
43
|
+
type: import('vue').PropType<"请输入内容...">;
|
44
|
+
default: "请输入内容...";
|
45
|
+
};
|
38
46
|
}>> & Readonly<{
|
39
47
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
40
48
|
}>, {
|
49
|
+
placeholder: "请输入内容...";
|
41
50
|
readonly: boolean;
|
42
51
|
uploadImage: (file: File) => {
|
43
52
|
url: string;
|
@@ -1,34 +1,37 @@
|
|
1
1
|
import "lodash-es";
|
2
|
-
import { defineComponent as
|
3
|
-
import { withInstall as
|
2
|
+
import { defineComponent as x, ref as l, onMounted as b, watch as s, onBeforeUnmount as y, createVNode as i } from "vue";
|
3
|
+
import { withInstall as T } from "../_util/vue/install.js";
|
4
4
|
import "element-plus";
|
5
5
|
import f from "../../error/OrionError.js";
|
6
|
-
import { booleanType as w, functionType as
|
7
|
-
import { createEditor as
|
8
|
-
const
|
6
|
+
import { booleanType as w, functionType as E, stringType as I } from "../_util/type.js";
|
7
|
+
import { createEditor as R, createToolbar as C } from "@wangeditor/editor";
|
8
|
+
const O = () => ({
|
9
9
|
modelValue: String,
|
10
10
|
readonly: w(!1),
|
11
|
-
uploadImage:
|
12
|
-
|
11
|
+
uploadImage: E(),
|
12
|
+
placeholder: I("请输入内容...")
|
13
|
+
}), V = /* @__PURE__ */ x({
|
13
14
|
name: "ORichTextEditor",
|
14
15
|
inheritAttrs: !1,
|
15
|
-
props:
|
16
|
+
props: O(),
|
16
17
|
emits: ["update:modelValue"],
|
17
18
|
setup(t, {
|
18
|
-
slots:
|
19
|
-
attrs:
|
19
|
+
slots: M,
|
20
|
+
attrs: U,
|
20
21
|
emit: m,
|
21
22
|
expose: p
|
22
23
|
}) {
|
23
|
-
const
|
24
|
+
const {
|
25
|
+
placeholder: h
|
26
|
+
} = t, e = l(null), v = l(), d = l(), u = l();
|
24
27
|
return p({
|
25
28
|
focus: () => {
|
26
29
|
var o;
|
27
30
|
(o = e.value) == null || o.focus();
|
28
31
|
}
|
29
|
-
}),
|
32
|
+
}), b(() => {
|
30
33
|
const o = {
|
31
|
-
placeholder:
|
34
|
+
placeholder: h,
|
32
35
|
onChange(a) {
|
33
36
|
const n = a.getHtml();
|
34
37
|
m("update:modelValue", n);
|
@@ -52,7 +55,7 @@ const R = () => ({
|
|
52
55
|
}
|
53
56
|
}
|
54
57
|
}
|
55
|
-
}, c =
|
58
|
+
}, c = R({
|
56
59
|
selector: d.value,
|
57
60
|
html: t.modelValue,
|
58
61
|
// 初始值
|
@@ -60,13 +63,13 @@ const R = () => ({
|
|
60
63
|
mode: "default"
|
61
64
|
});
|
62
65
|
e.value = c;
|
63
|
-
const
|
66
|
+
const g = {
|
64
67
|
excludeKeys: ["blockquote", "bulletedList", "numberedList", "todo", "emotion", "insertLink", "insertImage", "group-video", "insertTable", "codeBlock"]
|
65
68
|
};
|
66
|
-
|
69
|
+
C({
|
67
70
|
editor: c,
|
68
71
|
selector: u.value,
|
69
|
-
config:
|
72
|
+
config: g,
|
70
73
|
mode: "default"
|
71
74
|
// or 'simple'
|
72
75
|
});
|
@@ -74,11 +77,11 @@ const R = () => ({
|
|
74
77
|
e.value && e.value.setHtml(o || "");
|
75
78
|
}), s(() => t.readonly, (o) => {
|
76
79
|
e.value && (o ? e.value.disable() : e.value.enable());
|
77
|
-
}),
|
80
|
+
}), y(() => {
|
78
81
|
e.value != null && (e.value.destroy(), e.value = null);
|
79
82
|
}), () => i("div", {
|
80
83
|
class: "orion-rich-text-editor—wrapper",
|
81
|
-
ref:
|
84
|
+
ref: v,
|
82
85
|
style: {
|
83
86
|
border: "1px solid #ccc",
|
84
87
|
zIndex: 100
|
@@ -97,10 +100,10 @@ const R = () => ({
|
|
97
100
|
}
|
98
101
|
}, null)]);
|
99
102
|
}
|
100
|
-
}),
|
101
|
-
|
103
|
+
}), q = T(
|
104
|
+
V
|
102
105
|
);
|
103
106
|
export {
|
104
|
-
|
107
|
+
q as default
|
105
108
|
};
|
106
109
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx","../../../src/components/RichTextEditor/index.ts"],"sourcesContent":["import { computed, defineComponent, ref, onBeforeUnmount, onMounted, watch } from 'vue'\r\nimport type { PropType, ExtractPropTypes, CSSProperties, Plugin, App } from 'vue'\r\nimport classNames from '../_util/classNames'\r\nimport OrionError from '../../error/OrionError'\r\nimport { anyType, booleanType, functionType, objectType, someType, stringType, tuple } from '../_util/type'\r\n\r\nimport { createEditor, createToolbar, DomEditor } from '@wangeditor/editor'\r\nimport type { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor/editor'\r\n\r\nexport const richTextEditorProps = () => ({\r\n modelValue: String,\r\n readonly: booleanType(false),\r\n uploadImage: functionType<(file: File) => { url: string; alt?: string; href?: string } | null | false>(),\r\n})\r\n\r\nexport type RichTextEditorProps = Partial<ExtractPropTypes<ReturnType<typeof richTextEditorProps>>>\r\n\r\ntype InsertFnType = (url: string, alt: string, href: string) => void\r\n\r\nexport default defineComponent({\r\n name: 'ORichTextEditor',\r\n inheritAttrs: false,\r\n props: richTextEditorProps(),\r\n emits: ['update:modelValue'],\r\n setup(props, { slots, attrs, emit, expose }) {\r\n const editorRef = ref<IDomEditor | null>(null) // TS 语法\r\n const editorWrapperDOMRef = ref<HTMLDivElement>()\r\n const editorContainerDOMRef = ref<HTMLDivElement>()\r\n const toolbarContainerDOMRef = ref<HTMLDivElement>()\r\n\r\n expose({\r\n focus: () => {\r\n editorRef.value?.focus()\r\n },\r\n })\r\n\r\n onMounted(() => {\r\n // 编辑器配置\r\n const editorConfig: IEditorConfig = {\r\n placeholder
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/RichTextEditor/RichTextEditor.tsx","../../../src/components/RichTextEditor/index.ts"],"sourcesContent":["import { computed, defineComponent, ref, onBeforeUnmount, onMounted, watch } from 'vue'\r\nimport type { PropType, ExtractPropTypes, CSSProperties, Plugin, App } from 'vue'\r\nimport classNames from '../_util/classNames'\r\nimport OrionError from '../../error/OrionError'\r\nimport { anyType, booleanType, functionType, objectType, someType, stringType, tuple } from '../_util/type'\r\n\r\nimport { createEditor, createToolbar, DomEditor } from '@wangeditor/editor'\r\nimport type { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor/editor'\r\n\r\nexport const richTextEditorProps = () => ({\r\n modelValue: String,\r\n readonly: booleanType(false),\r\n uploadImage: functionType<(file: File) => { url: string; alt?: string; href?: string } | null | false>(),\r\n placeholder: stringType('请输入内容...'),\r\n})\r\n\r\nexport type RichTextEditorProps = Partial<ExtractPropTypes<ReturnType<typeof richTextEditorProps>>>\r\n\r\ntype InsertFnType = (url: string, alt: string, href: string) => void\r\n\r\nexport default defineComponent({\r\n name: 'ORichTextEditor',\r\n inheritAttrs: false,\r\n props: richTextEditorProps(),\r\n emits: ['update:modelValue'],\r\n setup(props, { slots, attrs, emit, expose }) {\r\n const { placeholder } = props\r\n\r\n const editorRef = ref<IDomEditor | null>(null) // TS 语法\r\n const editorWrapperDOMRef = ref<HTMLDivElement>()\r\n const editorContainerDOMRef = ref<HTMLDivElement>()\r\n const toolbarContainerDOMRef = ref<HTMLDivElement>()\r\n\r\n expose({\r\n focus: () => {\r\n editorRef.value?.focus()\r\n },\r\n })\r\n\r\n onMounted(() => {\r\n // 编辑器配置\r\n const editorConfig: IEditorConfig = {\r\n placeholder,\r\n onChange(editor) {\r\n const html = editor.getHtml()\r\n emit('update:modelValue', html)\r\n },\r\n readOnly: props.readonly,\r\n autoFocus: true,\r\n scroll: true,\r\n MENU_CONF: {\r\n uploadImage: {\r\n // 自定义上传\r\n async customUpload(file: File, insertFn: InsertFnType) {\r\n if (props.uploadImage) {\r\n const ret = await props.uploadImage(file)\r\n\r\n if (ret == null || ret === false) {\r\n return\r\n }\r\n\r\n if (!ret.url) {\r\n throw new OrionError(`RichTextEditor: 图片上传接口 uploadImage 的返回数据中未包含 url 字段。`)\r\n }\r\n\r\n insertFn(ret.url, ret.alt, ret.href)\r\n } else {\r\n throw new OrionError(`RichTextEditor: 未实现文件上传接口onUpload。`)\r\n }\r\n },\r\n },\r\n },\r\n }\r\n const editor = createEditor({\r\n selector: editorContainerDOMRef.value!,\r\n html: props.modelValue, // 初始值\r\n config: editorConfig,\r\n mode: 'default',\r\n })\r\n editorRef.value = editor\r\n\r\n // 工具栏配置\r\n const toolbarConfig: Partial<IToolbarConfig> = {\r\n excludeKeys: ['blockquote', 'bulletedList', 'numberedList', 'todo', 'emotion', 'insertLink', 'insertImage', 'group-video', 'insertTable', 'codeBlock'],\r\n }\r\n\r\n const toolbar = createToolbar({\r\n editor,\r\n selector: toolbarContainerDOMRef.value!,\r\n config: toolbarConfig,\r\n mode: 'default', // or 'simple'\r\n })\r\n\r\n // const t = DomEditor.getToolbar(editor)\r\n // const curToolbarConfig = t.getConfig()\r\n // console.log(curToolbarConfig.toolbarKeys) // 当前菜单排序和分组\r\n })\r\n\r\n watch(\r\n () => props.modelValue,\r\n (modelValue) => {\r\n if (editorRef.value) {\r\n editorRef.value.setHtml(modelValue || '')\r\n }\r\n }\r\n )\r\n\r\n watch(\r\n () => props.readonly,\r\n (readonly) => {\r\n if (editorRef.value) {\r\n if (readonly) {\r\n editorRef.value.disable()\r\n } else {\r\n editorRef.value.enable()\r\n }\r\n }\r\n }\r\n )\r\n\r\n onBeforeUnmount(() => {\r\n if (editorRef.value == null) return\r\n editorRef.value.destroy()\r\n editorRef.value = null\r\n })\r\n\r\n return () => {\r\n return (\r\n <div class=\"orion-rich-text-editor—wrapper\" ref={editorWrapperDOMRef} style={{ border: '1px solid #ccc', zIndex: 100 }}>\r\n <div class=\"orion-rich-text-toolbar-container\" ref={toolbarContainerDOMRef} style={{ borderBottom: '1px solid #ccc' }}></div>\r\n <div class=\"orion-rich-text-editor-container\" ref={editorContainerDOMRef} style={{ overflowY: 'hidden' }}></div>\r\n </div>\r\n )\r\n }\r\n },\r\n})\r\n","import { withInstall } from '../_util'\r\n\r\nimport RichTextEditor from './RichTextEditor'\r\n\r\nexport type { RichTextEditorProps } from \"./RichTextEditor\"\r\n\r\nexport default withInstall<typeof RichTextEditor, {}>(\r\n RichTextEditor\r\n)\r\n"],"names":["richTextEditorProps","modelValue","String","readonly","booleanType","uploadImage","functionType","placeholder","stringType","defineComponent","name","inheritAttrs","props","emits","setup","slots","attrs","emit","expose","editorRef","ref","editorWrapperDOMRef","editorContainerDOMRef","toolbarContainerDOMRef","focus","value","onMounted","editorConfig","onChange","editor","html","getHtml","readOnly","autoFocus","scroll","MENU_CONF","customUpload","file","insertFn","ret","url","OrionError","alt","href","createEditor","selector","config","mode","toolbarConfig","excludeKeys","createToolbar","watch","setHtml","disable","enable","onBeforeUnmount","destroy","_createVNode","border","zIndex","borderBottom","overflowY","index","withInstall","RichTextEditor"],"mappings":";;;;;;;AASO,MAAMA,IAAsBA,OAAO;AAAA,EACxCC,YAAYC;AAAAA,EACZC,UAAUC,EAAY,EAAK;AAAA,EAC3BC,aAAaC,EAA2F;AAAA,EACxGC,aAAaC,EAAW,UAAU;A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GCjIDC,IAAeC;AAAA,EACbC;AACF;"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: "0.1.
|
1
|
+
declare const _default: "0.1.47";
|
2
2
|
export default _default;
|
package/dist/version/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../src/version/version.ts"],"sourcesContent":["export default '0.1.
|
1
|
+
{"version":3,"file":"version.js","sources":["../../src/version/version.ts"],"sourcesContent":["export default '0.1.47';"],"names":["version"],"mappings":"AAAA,MAAAA,IAAe;"}
|