@cgboiler/biz-basic 1.0.42 → 1.0.44

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.41";
8
+ export const version: "1.0.43";
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.41";
2
+ const version = "1.0.43";
3
3
  function install(app) {
4
4
  const components = [
5
5
  RichTextEditor
@@ -120,6 +120,10 @@ var stdin_default = defineComponent({
120
120
  isFocusFromPlaceholder = false;
121
121
  }, 100);
122
122
  });
123
+ watch(() => props.editable, (val) => {
124
+ var _a;
125
+ (_a = editor.value) == null ? void 0 : _a.setEditable(val);
126
+ });
123
127
  const viewerRef = ref(null);
124
128
  const imageClickHandler = (event) => {
125
129
  const target = event.target;
@@ -70,13 +70,38 @@ function useExtensions({ props, emit }) {
70
70
  * - 异常:无。
71
71
  */
72
72
  onKeyDown({ event }) {
73
- if (event.key === " ") {
73
+ const isSpaceKey = event.key === " " || event.key === "Space" || event.key === "Spacebar" || // @ts-ignore 兼容旧浏览器/环境的数值键码
74
+ event.keyCode === 32 || // 兼容部分环境的 event.code 标识
75
+ event.code === "Space";
76
+ if (isSpaceKey) {
74
77
  exitCause = "space";
75
78
  return false;
76
79
  }
77
80
  return false;
78
81
  },
82
+ /**
83
+ * onExit
84
+ * - 功能:建议态结束时向外部发送退出事件,并尽可能准确地判断退出原因。
85
+ * - 设计考量:
86
+ * - 安卓设备上软键盘可能不触发标准 keydown 空格;此时通过检查当前选择位置前一个字符是否为空格来回溯判断。
87
+ * - 参数:无。
88
+ * - 返回值:无(通过 emit 派发事件)。
89
+ * - 异常:内部读取选择/文档时若发生异常,捕获后保持原有退出原因,不影响外部流程。
90
+ */
79
91
  onExit() {
92
+ var _a, _b, _c, _d, _e;
93
+ try {
94
+ const editorRef = activeEditor;
95
+ if (editorRef) {
96
+ const sel = (_a = editorRef.state) == null ? void 0 : _a.selection;
97
+ const from = (_b = sel == null ? void 0 : sel.from) != null ? _b : 0;
98
+ const prevChar = (_e = (_d = (_c = editorRef.state) == null ? void 0 : _c.doc) == null ? void 0 : _d.textBetween(Math.max(from - 1, 0), from, "\0", "\0")) != null ? _e : "";
99
+ if (prevChar === " ") {
100
+ exitCause = "space";
101
+ }
102
+ }
103
+ } catch (e) {
104
+ }
80
105
  activeRange = null;
81
106
  activeEditor = null;
82
107
  const payload = {
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.41";
8
+ export const version: "1.0.43";
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.41";
39
+ const version = "1.0.43";
40
40
  function install(app) {
41
41
  const components = [
42
42
  import_rich_text_editor.default
@@ -152,6 +152,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
152
152
  isFocusFromPlaceholder = false;
153
153
  }, 100);
154
154
  });
155
+ (0, import_vue2.watch)(() => props.editable, (val) => {
156
+ var _a;
157
+ (_a = editor.value) == null ? void 0 : _a.setEditable(val);
158
+ });
155
159
  const viewerRef = (0, import_vue2.ref)(null);
156
160
  const imageClickHandler = (event) => {
157
161
  const target = event.target;
@@ -102,13 +102,38 @@ function useExtensions({ props, emit }) {
102
102
  * - 异常:无。
103
103
  */
104
104
  onKeyDown({ event }) {
105
- if (event.key === " ") {
105
+ const isSpaceKey = event.key === " " || event.key === "Space" || event.key === "Spacebar" || // @ts-ignore 兼容旧浏览器/环境的数值键码
106
+ event.keyCode === 32 || // 兼容部分环境的 event.code 标识
107
+ event.code === "Space";
108
+ if (isSpaceKey) {
106
109
  exitCause = "space";
107
110
  return false;
108
111
  }
109
112
  return false;
110
113
  },
114
+ /**
115
+ * onExit
116
+ * - 功能:建议态结束时向外部发送退出事件,并尽可能准确地判断退出原因。
117
+ * - 设计考量:
118
+ * - 安卓设备上软键盘可能不触发标准 keydown 空格;此时通过检查当前选择位置前一个字符是否为空格来回溯判断。
119
+ * - 参数:无。
120
+ * - 返回值:无(通过 emit 派发事件)。
121
+ * - 异常:内部读取选择/文档时若发生异常,捕获后保持原有退出原因,不影响外部流程。
122
+ */
111
123
  onExit() {
124
+ var _a, _b, _c, _d, _e;
125
+ try {
126
+ const editorRef = activeEditor;
127
+ if (editorRef) {
128
+ const sel = (_a = editorRef.state) == null ? void 0 : _a.selection;
129
+ const from = (_b = sel == null ? void 0 : sel.from) != null ? _b : 0;
130
+ const prevChar = (_e = (_d = (_c = editorRef.state) == null ? void 0 : _c.doc) == null ? void 0 : _d.textBetween(Math.max(from - 1, 0), from, "\0", "\0")) != null ? _e : "";
131
+ if (prevChar === " ") {
132
+ exitCause = "space";
133
+ }
134
+ }
135
+ } catch (e) {
136
+ }
112
137
  activeRange = null;
113
138
  activeEditor = null;
114
139
  const payload = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgboiler/biz-basic",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",