@cgboiler/biz-basic 1.0.24 → 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 CHANGED
@@ -5,6 +5,6 @@ declare namespace _default {
5
5
  }
6
6
  export default _default;
7
7
  export function install(app: any): void;
8
- export const version: "1.0.23";
8
+ export const version: "1.0.24";
9
9
  import RichTextEditor from './rich-text-editor';
10
10
  export { RichTextEditor };
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import RichTextEditor from "./rich-text-editor";
2
- const version = "1.0.23";
2
+ const version = "1.0.24";
3
3
  function install(app) {
4
4
  const components = [
5
5
  RichTextEditor
@@ -1,3 +1,4 @@
1
+ import "viewerjs/dist/viewer.css";
1
2
  import './index.less';
2
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
4
  modelValue: {
@@ -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";
@@ -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.destroy();
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
@@ -5,6 +5,6 @@ declare namespace _default {
5
5
  }
6
6
  export default _default;
7
7
  export function install(app: any): void;
8
- export const version: "1.0.23";
8
+ export const version: "1.0.24";
9
9
  import RichTextEditor from './rich-text-editor';
10
10
  export { RichTextEditor };
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.23";
39
+ const version = "1.0.24";
40
40
  function install(app) {
41
41
  const components = [
42
42
  import_rich_text_editor.default
@@ -1,3 +1,4 @@
1
+ import "viewerjs/dist/viewer.css";
1
2
  import './index.less';
2
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
4
  modelValue: {
@@ -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");
@@ -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.destroy();
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.24",
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",