@ebl-vue/editor-full 2.31.18 → 2.31.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebl-vue/editor-full",
3
- "version": "2.31.18",
3
+ "version": "2.31.20",
4
4
  "type": "module",
5
5
  "author": "lrj525@sina.com",
6
6
  "description": "结构化编辑器",
package/src/i18n/zh-cn.ts CHANGED
@@ -80,7 +80,7 @@ const zhCn: I18nConfig = {
80
80
  },
81
81
  link: {
82
82
  "Add a link":"添加链接",
83
- "Save": "保存",
83
+ "Save": "确定",
84
84
  "Pasted link is not valid.":"链接地址无效"
85
85
  },
86
86
  "List": {
@@ -105,7 +105,8 @@ const zhCn: I18nConfig = {
105
105
 
106
106
  "code": {
107
107
  "Enter your code": "输入代码",
108
- "Copied": "已复制"
108
+ "Copied": "已复制",
109
+ "Unable to copy": "复制失败"
109
110
  },
110
111
  "convertTo": {
111
112
  "Convert to": "转化为"
@@ -508,17 +508,14 @@ export default class CodeTool implements BlockTool {
508
508
  }
509
509
 
510
510
  }
511
-
512
- private copyCode(code: string, event: MouseEvent) {
513
- if (this.data.code) {
514
- if (navigator.clipboard && window.isSecureContext) {
515
- try {
516
- navigator.clipboard.writeText(code).then(() => {
517
- if (event.target) {
511
+ private showCopyTip(msg: string,event: MouseEvent) {
512
+ const tip = this.api.i18n.t(msg);
513
+ if (event.target) {
518
514
  const parentEle = (event.target as HTMLElement).parentElement;
519
515
  if (parentEle) {
520
516
  const tooltip = parentEle.lastChild as HTMLElement;
521
517
  if (tooltip) {
518
+ tooltip.innerHTML = tip;
522
519
  tooltip.classList.add('visible');
523
520
  setTimeout(() => {
524
521
  tooltip.classList.remove('visible');
@@ -527,13 +524,20 @@ export default class CodeTool implements BlockTool {
527
524
  }
528
525
  }
529
526
  }
527
+ }
528
+ private copyCode(code: string, event: MouseEvent) {
529
+ if (this.data.code) {
530
+ if (navigator.clipboard && window.isSecureContext) {
531
+ try {
532
+ navigator.clipboard.writeText(code).then(() => {
533
+ this.showCopyTip('Copied',event);
530
534
  }).catch((err) => {
531
- console.error(err);
532
- alert("复制失败");
535
+ console.error(err);
536
+ this.showCopyTip('Unable to copy',event);
533
537
  });
534
538
 
535
539
  } catch (err) {
536
- alert("复制失败");
540
+ this.showCopyTip('Unable to copy',event);
537
541
  }
538
542
  } else {
539
543
  // 传统方法:使用 textarea 和 execCommand
@@ -554,9 +558,10 @@ export default class CodeTool implements BlockTool {
554
558
  textArea.select();
555
559
  try {
556
560
  document.execCommand('copy');
557
- document.body.removeChild(textArea);
561
+ document.body.removeChild(textArea);
562
+ this.showCopyTip('Copied',event);
558
563
  } catch (err) {
559
- alert("复制失败");
564
+ this.showCopyTip('Unable to copy',event);
560
565
  document.body.removeChild(textArea);
561
566
 
562
567
  }
@@ -19,7 +19,6 @@ export default class Outline{
19
19
  }
20
20
 
21
21
  public render(data: OutputData) {
22
- console.log(data);
23
22
  const ui = this.createUI(data);
24
23
  this.holder.querySelector('.ebl-outline')?.remove();
25
24
  this.holder.appendChild(ui);