@cgboiler/biz-basic 1.0.23 → 1.0.25
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/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/rich-text-editor/RichTextEditor.d.ts +1 -0
- package/es/rich-text-editor/RichTextEditor.js +54 -12
- package/es/rich-text-editor/_atomic.css +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/rich-text-editor/RichTextEditor.d.ts +1 -0
- package/lib/rich-text-editor/RichTextEditor.js +63 -11
- package/lib/rich-text-editor/_atomic.css +1 -0
- package/package.json +3 -2
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
|
2
2
|
import "./_atomic.css";
|
|
3
|
-
import { defineComponent, onMounted, onBeforeUnmount, ref, watch } from "vue";
|
|
3
|
+
import { defineComponent, onMounted, onBeforeUnmount, ref, watch, nextTick } from "vue";
|
|
4
4
|
import { Editor, EditorContent } from "@tiptap/vue-3";
|
|
5
|
+
import Viewer from "viewerjs";
|
|
6
|
+
import "viewerjs/dist/viewer.css";
|
|
5
7
|
import { useExtensions } from "./useExtensions";
|
|
6
8
|
import { richTextEditorProps } from "./types";
|
|
7
9
|
import "./index.css";
|
|
@@ -23,15 +25,15 @@ var stdin_default = defineComponent({
|
|
|
23
25
|
editor.value = new Editor({
|
|
24
26
|
extensions,
|
|
25
27
|
content: props.modelValue,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
28
|
+
editable: props.editable,
|
|
29
|
+
// onMount: ({ editor }) => {
|
|
30
|
+
// // 非可编辑状态下,需要手动设置 contenteditable 为 false
|
|
31
|
+
// if (props.editable === false) {
|
|
32
|
+
// editor.setOptions({
|
|
33
|
+
// editable: false,
|
|
34
|
+
// });
|
|
35
|
+
// }
|
|
36
|
+
// },
|
|
35
37
|
onUpdate: ({
|
|
36
38
|
editor: editor2
|
|
37
39
|
}) => {
|
|
@@ -87,12 +89,52 @@ var stdin_default = defineComponent({
|
|
|
87
89
|
isFocusFromPlaceholder = false;
|
|
88
90
|
}, 100);
|
|
89
91
|
});
|
|
92
|
+
const viewerRef = ref(null);
|
|
93
|
+
const imageClickHandler = (event) => {
|
|
94
|
+
const target = event.target;
|
|
95
|
+
if (target.tagName === "IMG") {
|
|
96
|
+
if (viewerRef.value) {
|
|
97
|
+
viewerRef.value.destroy();
|
|
98
|
+
}
|
|
99
|
+
viewerRef.value = new Viewer(target, {
|
|
100
|
+
inline: false,
|
|
101
|
+
navbar: true,
|
|
102
|
+
title: true,
|
|
103
|
+
toolbar: {
|
|
104
|
+
zoomIn: true,
|
|
105
|
+
zoomOut: true,
|
|
106
|
+
oneToOne: true,
|
|
107
|
+
reset: true,
|
|
108
|
+
prev: false,
|
|
109
|
+
next: false,
|
|
110
|
+
rotateLeft: true,
|
|
111
|
+
rotateRight: true,
|
|
112
|
+
flipHorizontal: true,
|
|
113
|
+
flipVertical: true
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
viewerRef.value.show();
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
90
121
|
onMounted(() => {
|
|
91
122
|
initEditor();
|
|
123
|
+
nextTick(() => {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
126
|
+
if (editorElement) {
|
|
127
|
+
editorElement.addEventListener("click", imageClickHandler);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
92
130
|
});
|
|
93
131
|
onBeforeUnmount(() => {
|
|
94
|
-
var _a;
|
|
95
|
-
(_a = editor.value) == null ? void 0 : _a.
|
|
132
|
+
var _a, _b, _c;
|
|
133
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
134
|
+
if (editorElement) {
|
|
135
|
+
editorElement.removeEventListener("click", imageClickHandler);
|
|
136
|
+
}
|
|
137
|
+
(_c = editor.value) == null ? void 0 : _c.destroy();
|
|
96
138
|
});
|
|
97
139
|
return () => _createVNode(EditorContent, {
|
|
98
140
|
"class": "ProseMirror",
|
|
@@ -31,4 +31,5 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/* layer: default */
|
|
34
|
+
.cgx-atm .inline{display:inline;}
|
|
34
35
|
.cgx-atm .blur{--un-blur:blur(8px);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia);}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(stdin_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(stdin_exports);
|
|
37
37
|
var import_rich_text_editor = __toESM(require("./rich-text-editor"));
|
|
38
38
|
__reExport(stdin_exports, require("./rich-text-editor"), module.exports);
|
|
39
|
-
const version = "1.0.
|
|
39
|
+
const version = "1.0.24";
|
|
40
40
|
function install(app) {
|
|
41
41
|
const components = [
|
|
42
42
|
import_rich_text_editor.default
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
var stdin_exports = {};
|
|
19
29
|
__export(stdin_exports, {
|
|
@@ -24,6 +34,8 @@ var import_vue = require("vue");
|
|
|
24
34
|
var import_atomic = require("./_atomic.css");
|
|
25
35
|
var import_vue2 = require("vue");
|
|
26
36
|
var import_vue_3 = require("@tiptap/vue-3");
|
|
37
|
+
var import_viewerjs = __toESM(require("viewerjs"));
|
|
38
|
+
var import_viewer = require("viewerjs/dist/viewer.css");
|
|
27
39
|
var import_useExtensions = require("./useExtensions");
|
|
28
40
|
var import_types = require("./types");
|
|
29
41
|
var import_index = require("./index.css");
|
|
@@ -45,15 +57,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
45
57
|
editor.value = new import_vue_3.Editor({
|
|
46
58
|
extensions,
|
|
47
59
|
content: props.modelValue,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
60
|
+
editable: props.editable,
|
|
61
|
+
// onMount: ({ editor }) => {
|
|
62
|
+
// // 非可编辑状态下,需要手动设置 contenteditable 为 false
|
|
63
|
+
// if (props.editable === false) {
|
|
64
|
+
// editor.setOptions({
|
|
65
|
+
// editable: false,
|
|
66
|
+
// });
|
|
67
|
+
// }
|
|
68
|
+
// },
|
|
57
69
|
onUpdate: ({
|
|
58
70
|
editor: editor2
|
|
59
71
|
}) => {
|
|
@@ -109,12 +121,52 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
109
121
|
isFocusFromPlaceholder = false;
|
|
110
122
|
}, 100);
|
|
111
123
|
});
|
|
124
|
+
const viewerRef = (0, import_vue2.ref)(null);
|
|
125
|
+
const imageClickHandler = (event) => {
|
|
126
|
+
const target = event.target;
|
|
127
|
+
if (target.tagName === "IMG") {
|
|
128
|
+
if (viewerRef.value) {
|
|
129
|
+
viewerRef.value.destroy();
|
|
130
|
+
}
|
|
131
|
+
viewerRef.value = new import_viewerjs.default(target, {
|
|
132
|
+
inline: false,
|
|
133
|
+
navbar: true,
|
|
134
|
+
title: true,
|
|
135
|
+
toolbar: {
|
|
136
|
+
zoomIn: true,
|
|
137
|
+
zoomOut: true,
|
|
138
|
+
oneToOne: true,
|
|
139
|
+
reset: true,
|
|
140
|
+
prev: false,
|
|
141
|
+
next: false,
|
|
142
|
+
rotateLeft: true,
|
|
143
|
+
rotateRight: true,
|
|
144
|
+
flipHorizontal: true,
|
|
145
|
+
flipVertical: true
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
viewerRef.value.show();
|
|
149
|
+
event.stopPropagation();
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
}
|
|
152
|
+
};
|
|
112
153
|
(0, import_vue2.onMounted)(() => {
|
|
113
154
|
initEditor();
|
|
155
|
+
(0, import_vue2.nextTick)(() => {
|
|
156
|
+
var _a, _b;
|
|
157
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
158
|
+
if (editorElement) {
|
|
159
|
+
editorElement.addEventListener("click", imageClickHandler);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
114
162
|
});
|
|
115
163
|
(0, import_vue2.onBeforeUnmount)(() => {
|
|
116
|
-
var _a;
|
|
117
|
-
(_a = editor.value) == null ? void 0 : _a.
|
|
164
|
+
var _a, _b, _c;
|
|
165
|
+
const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
|
|
166
|
+
if (editorElement) {
|
|
167
|
+
editorElement.removeEventListener("click", imageClickHandler);
|
|
168
|
+
}
|
|
169
|
+
(_c = editor.value) == null ? void 0 : _c.destroy();
|
|
118
170
|
});
|
|
119
171
|
return () => (0, import_vue.createVNode)(import_vue_3.EditorContent, {
|
|
120
172
|
"class": "ProseMirror",
|
|
@@ -31,4 +31,5 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/* layer: default */
|
|
34
|
+
.cgx-atm .inline{display:inline;}
|
|
34
35
|
.cgx-atm .blur{--un-blur:blur(8px);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgboiler/biz-basic",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"@tiptap/pm": "3.3.0",
|
|
52
52
|
"@tiptap/starter-kit": "3.3.0",
|
|
53
53
|
"@tiptap/vue-3": "3.3.0",
|
|
54
|
-
"tiptap-markdown": "^0.8.10"
|
|
54
|
+
"tiptap-markdown": "^0.8.10",
|
|
55
|
+
"viewerjs": "^1.11.7"
|
|
55
56
|
},
|
|
56
57
|
"browserslist": [
|
|
57
58
|
"Chrome >= 51",
|