@cgboiler/biz-basic 1.0.28 → 1.0.30

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.27";
8
+ export const version: "1.0.29";
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.27";
2
+ const version = "1.0.29";
3
3
  function install(app) {
4
4
  const components = [
5
5
  RichTextEditor
@@ -1,4 +1,4 @@
1
- import "viewerjs/dist/viewer.css";
1
+ import 'viewerjs/dist/viewer.css';
2
2
  import './index.less';
3
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
4
  modelValue: {
@@ -141,24 +141,18 @@ var stdin_default = defineComponent({
141
141
  };
142
142
  const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
143
143
  const MAX_HISTORY_ITEMS = 10;
144
- let saveIntervalId = null;
144
+ let saveTimeoutId = null;
145
145
  const noteId = ref("");
146
146
  const historyStore = localforage.createInstance({
147
147
  name: "RichTextEditorHistory",
148
148
  storeName: "notes"
149
149
  });
150
- onMounted(() => {
151
- initEditor();
152
- const now = /* @__PURE__ */ new Date();
153
- const formattedTime = `${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
154
- noteId.value = `note-${now.getTime()}`;
155
- const noteTitle = `\u7B14\u8BB0 at ${formattedTime}`;
156
- saveIntervalId = setInterval(() => __async(this, null, function* () {
157
- if (!editor.value || editor.value.isDestroyed || !editor.value.isEditable) {
158
- return;
159
- }
150
+ const saveLoop = () => __async(this, null, function* () {
151
+ if (editor.value && !editor.value.isDestroyed && editor.value.isEditable) {
160
152
  const content = editor.value.getHTML();
161
- console.log("content: ", content);
153
+ const now = /* @__PURE__ */ new Date();
154
+ const formattedTime = `${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
155
+ const noteTitle = `\u7B14\u8BB0 at ${formattedTime}`;
162
156
  yield historyStore.setItem(noteId.value, {
163
157
  title: noteTitle,
164
158
  content
@@ -179,7 +173,16 @@ var stdin_default = defineComponent({
179
173
  }
180
174
  yield historyStore.setItem(HISTORY_METADATA_KEY, metadata);
181
175
  }
182
- }), 1e4);
176
+ }
177
+ saveTimeoutId = setTimeout(saveLoop, 1e4);
178
+ });
179
+ onMounted(() => {
180
+ initEditor();
181
+ const now = /* @__PURE__ */ new Date();
182
+ noteId.value = `note-${now.getTime()}`;
183
+ if (props.editable) {
184
+ saveLoop();
185
+ }
183
186
  nextTick(() => {
184
187
  var _a, _b;
185
188
  const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
@@ -190,8 +193,8 @@ var stdin_default = defineComponent({
190
193
  });
191
194
  onBeforeUnmount(() => {
192
195
  var _a, _b, _c;
193
- if (saveIntervalId) {
194
- clearInterval(saveIntervalId);
196
+ if (saveTimeoutId) {
197
+ clearTimeout(saveTimeoutId);
195
198
  }
196
199
  const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
197
200
  if (editorElement) {
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.27";
8
+ export const version: "1.0.29";
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.27";
39
+ const version = "1.0.29";
40
40
  function install(app) {
41
41
  const components = [
42
42
  import_rich_text_editor.default
@@ -1,4 +1,4 @@
1
- import "viewerjs/dist/viewer.css";
1
+ import 'viewerjs/dist/viewer.css';
2
2
  import './index.less';
3
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
4
  modelValue: {
@@ -173,24 +173,18 @@ var stdin_default = (0, import_vue2.defineComponent)({
173
173
  };
174
174
  const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
175
175
  const MAX_HISTORY_ITEMS = 10;
176
- let saveIntervalId = null;
176
+ let saveTimeoutId = null;
177
177
  const noteId = (0, import_vue2.ref)("");
178
178
  const historyStore = import_localforage.default.createInstance({
179
179
  name: "RichTextEditorHistory",
180
180
  storeName: "notes"
181
181
  });
182
- (0, import_vue2.onMounted)(() => {
183
- initEditor();
184
- const now = /* @__PURE__ */ new Date();
185
- const formattedTime = `${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
186
- noteId.value = `note-${now.getTime()}`;
187
- const noteTitle = `\u7B14\u8BB0 at ${formattedTime}`;
188
- saveIntervalId = setInterval(() => __async(this, null, function* () {
189
- if (!editor.value || editor.value.isDestroyed || !editor.value.isEditable) {
190
- return;
191
- }
182
+ const saveLoop = () => __async(this, null, function* () {
183
+ if (editor.value && !editor.value.isDestroyed && editor.value.isEditable) {
192
184
  const content = editor.value.getHTML();
193
- console.log("content: ", content);
185
+ const now = /* @__PURE__ */ new Date();
186
+ const formattedTime = `${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
187
+ const noteTitle = `\u7B14\u8BB0 at ${formattedTime}`;
194
188
  yield historyStore.setItem(noteId.value, {
195
189
  title: noteTitle,
196
190
  content
@@ -211,7 +205,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
211
205
  }
212
206
  yield historyStore.setItem(HISTORY_METADATA_KEY, metadata);
213
207
  }
214
- }), 1e4);
208
+ }
209
+ saveTimeoutId = setTimeout(saveLoop, 1e4);
210
+ });
211
+ (0, import_vue2.onMounted)(() => {
212
+ initEditor();
213
+ const now = /* @__PURE__ */ new Date();
214
+ noteId.value = `note-${now.getTime()}`;
215
+ if (props.editable) {
216
+ saveLoop();
217
+ }
215
218
  (0, import_vue2.nextTick)(() => {
216
219
  var _a, _b;
217
220
  const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
@@ -222,8 +225,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
222
225
  });
223
226
  (0, import_vue2.onBeforeUnmount)(() => {
224
227
  var _a, _b, _c;
225
- if (saveIntervalId) {
226
- clearInterval(saveIntervalId);
228
+ if (saveTimeoutId) {
229
+ clearTimeout(saveTimeoutId);
227
230
  }
228
231
  const editorElement = (_b = (_a = editor.value) == null ? void 0 : _a.view) == null ? void 0 : _b.dom;
229
232
  if (editorElement) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgboiler/biz-basic",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",