@adminforth/rich-editor 1.6.12 → 1.6.14

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/build.log CHANGED
@@ -10,5 +10,5 @@ custom/package.json
10
10
  custom/quillEditor.vue
11
11
  custom/tsconfig.json
12
12
 
13
- sent 33,916 bytes received 115 bytes 68,062.00 bytes/sec
14
- total size is 33,499 speedup is 0.98
13
+ sent 34,602 bytes received 115 bytes 69,434.00 bytes/sec
14
+ total size is 34,185 speedup is 0.98
@@ -10,7 +10,7 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "quill": "^2.0.2",
13
- "quill-table-better-yaroslav8765": "^1.2.5"
13
+ "quill-table-better-yaroslav8765": "^1.2.6"
14
14
  }
15
15
  },
16
16
  "node_modules/@babel/runtime": {
@@ -181,9 +181,9 @@
181
181
  }
182
182
  },
183
183
  "node_modules/quill-table-better-yaroslav8765": {
184
- "version": "1.2.5",
185
- "resolved": "https://registry.npmjs.org/quill-table-better-yaroslav8765/-/quill-table-better-yaroslav8765-1.2.5.tgz",
186
- "integrity": "sha512-rgP6Ldyr1Z8AaDAyCUMalbHheciCbemPxGrZsWkDNoqJDx6gPXIfLJN19BX+yfvYsG6Kr/Tmz2JRz09jf27C3w==",
184
+ "version": "1.2.6",
185
+ "resolved": "https://registry.npmjs.org/quill-table-better-yaroslav8765/-/quill-table-better-yaroslav8765-1.2.6.tgz",
186
+ "integrity": "sha512-rQcTCNx9MMm7RtNZWl3+LoRnSf5B8exbfzQ4Q9XSMgqXFespxd6/xMyK19n/iGYHSIWPeVnmIfQ3W0zT8kg1Rw==",
187
187
  "license": "MIT",
188
188
  "dependencies": {
189
189
  "@babel/runtime": "^7.17.9",
@@ -11,6 +11,6 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "quill": "^2.0.2",
14
- "quill-table-better-yaroslav8765": "^1.2.5"
14
+ "quill-table-better-yaroslav8765": "^1.2.6"
15
15
  }
16
16
  }
@@ -10,6 +10,7 @@
10
10
  @keydown.tab.prevent.stop="approveCompletion('all')"
11
11
  @keydown.ctrl.right.prevent.stop="approveCompletion('word')"
12
12
  @keydown.ctrl.down.prevent.stop="startCompletion()"
13
+ @mousedown="textAreaClickHandler"
13
14
  >
14
15
 
15
16
  </div>
@@ -144,6 +145,7 @@ let lastText: string | null = null;
144
145
 
145
146
  const imageProgress = ref(0);
146
147
 
148
+ const selectedSymbolsCount = ref(0);
147
149
 
148
150
  async function saveToServer(file: File) {
149
151
  const fd = new FormData();
@@ -314,6 +316,10 @@ onMounted(() => {
314
316
  quill = new Quill(editor.value as HTMLElement, quillOptions);
315
317
  initValue(quill);
316
318
  lastText = quill.getText();
319
+ const linkButton = document.querySelector('.ql-link');
320
+ if (linkButton) {
321
+ linkButton.classList.add('ql-table-button-disabled');
322
+ }
317
323
 
318
324
  quill.on(Quill.events.TEXT_CHANGE, async (delta: any, oldDelta: any, source: string) => {
319
325
  dbg('🪽 TEXT_CHANGE fired ', delta, oldDelta, source);
@@ -332,6 +338,13 @@ onMounted(() => {
332
338
  editorFocused.value = true;
333
339
  startCompletion();
334
340
  }
341
+ if (range.length > 0) {
342
+ selectedSymbolsCount.value = range.length;
343
+ linkButton?.classList.remove('ql-table-button-disabled');
344
+ } else {
345
+ selectedSymbolsCount.value = 0;
346
+ linkButton.classList.add('ql-table-button-disabled');
347
+ }
335
348
  const text = quill.getText();
336
349
  // don't allow to select after completion
337
350
  // TODO
@@ -350,6 +363,13 @@ onMounted(() => {
350
363
  }
351
364
  });
352
365
 
366
+ function textAreaClickHandler() {
367
+ const linkButton = document.querySelector('.ql-link');
368
+ if (linkButton && selectedSymbolsCount.value === 0) {
369
+ linkButton.classList.add('ql-table-button-disabled');
370
+ }
371
+ }
372
+
353
373
  function isQuillContentEmpty(html: string): boolean {
354
374
  const div = document.createElement('div');
355
375
  div.innerHTML = html;
@@ -10,7 +10,7 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "quill": "^2.0.2",
13
- "quill-table-better-yaroslav8765": "^1.2.5"
13
+ "quill-table-better-yaroslav8765": "^1.2.6"
14
14
  }
15
15
  },
16
16
  "node_modules/@babel/runtime": {
@@ -181,9 +181,9 @@
181
181
  }
182
182
  },
183
183
  "node_modules/quill-table-better-yaroslav8765": {
184
- "version": "1.2.5",
185
- "resolved": "https://registry.npmjs.org/quill-table-better-yaroslav8765/-/quill-table-better-yaroslav8765-1.2.5.tgz",
186
- "integrity": "sha512-rgP6Ldyr1Z8AaDAyCUMalbHheciCbemPxGrZsWkDNoqJDx6gPXIfLJN19BX+yfvYsG6Kr/Tmz2JRz09jf27C3w==",
184
+ "version": "1.2.6",
185
+ "resolved": "https://registry.npmjs.org/quill-table-better-yaroslav8765/-/quill-table-better-yaroslav8765-1.2.6.tgz",
186
+ "integrity": "sha512-rQcTCNx9MMm7RtNZWl3+LoRnSf5B8exbfzQ4Q9XSMgqXFespxd6/xMyK19n/iGYHSIWPeVnmIfQ3W0zT8kg1Rw==",
187
187
  "license": "MIT",
188
188
  "dependencies": {
189
189
  "@babel/runtime": "^7.17.9",
@@ -11,6 +11,6 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "quill": "^2.0.2",
14
- "quill-table-better-yaroslav8765": "^1.2.5"
14
+ "quill-table-better-yaroslav8765": "^1.2.6"
15
15
  }
16
16
  }
@@ -10,6 +10,7 @@
10
10
  @keydown.tab.prevent.stop="approveCompletion('all')"
11
11
  @keydown.ctrl.right.prevent.stop="approveCompletion('word')"
12
12
  @keydown.ctrl.down.prevent.stop="startCompletion()"
13
+ @mousedown="textAreaClickHandler"
13
14
  >
14
15
 
15
16
  </div>
@@ -144,6 +145,7 @@ let lastText: string | null = null;
144
145
 
145
146
  const imageProgress = ref(0);
146
147
 
148
+ const selectedSymbolsCount = ref(0);
147
149
 
148
150
  async function saveToServer(file: File) {
149
151
  const fd = new FormData();
@@ -314,6 +316,10 @@ onMounted(() => {
314
316
  quill = new Quill(editor.value as HTMLElement, quillOptions);
315
317
  initValue(quill);
316
318
  lastText = quill.getText();
319
+ const linkButton = document.querySelector('.ql-link');
320
+ if (linkButton) {
321
+ linkButton.classList.add('ql-table-button-disabled');
322
+ }
317
323
 
318
324
  quill.on(Quill.events.TEXT_CHANGE, async (delta: any, oldDelta: any, source: string) => {
319
325
  dbg('🪽 TEXT_CHANGE fired ', delta, oldDelta, source);
@@ -332,6 +338,13 @@ onMounted(() => {
332
338
  editorFocused.value = true;
333
339
  startCompletion();
334
340
  }
341
+ if (range.length > 0) {
342
+ selectedSymbolsCount.value = range.length;
343
+ linkButton?.classList.remove('ql-table-button-disabled');
344
+ } else {
345
+ selectedSymbolsCount.value = 0;
346
+ linkButton.classList.add('ql-table-button-disabled');
347
+ }
335
348
  const text = quill.getText();
336
349
  // don't allow to select after completion
337
350
  // TODO
@@ -350,6 +363,13 @@ onMounted(() => {
350
363
  }
351
364
  });
352
365
 
366
+ function textAreaClickHandler() {
367
+ const linkButton = document.querySelector('.ql-link');
368
+ if (linkButton && selectedSymbolsCount.value === 0) {
369
+ linkButton.classList.add('ql-table-button-disabled');
370
+ }
371
+ }
372
+
353
373
  function isQuillContentEmpty(html: string): boolean {
354
374
  const div = document.createElement('div');
355
375
  div.innerHTML = html;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/rich-editor",
3
- "version": "1.6.12",
3
+ "version": "1.6.14",
4
4
  "description": "Rich editor plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",