@libs-ui/components-inputs-quill 0.2.356-36 → 0.2.356-37

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.
@@ -24,6 +24,75 @@ import { returnListObject } from '@libs-ui/services-http-request';
24
24
  import { lastValueFrom } from 'rxjs/internal/lastValueFrom';
25
25
  import { timer } from 'rxjs/internal/observable/timer';
26
26
 
27
+ const Block = Quill.import('blots/block');
28
+ class QuillDivBlot extends Block {
29
+ static tagName = 'div';
30
+ }
31
+
32
+ const Embed = Quill.import('blots/embed');
33
+ class QuillMentionBlot extends Embed {
34
+ static blotName = 'mention';
35
+ static tagName = 'span';
36
+ static className = 'libs-ui-quill-mention';
37
+ static create(data) {
38
+ const node = super.create();
39
+ node.innerText += data.value;
40
+ node.setAttribute('id', data.id);
41
+ node.setAttribute('feId', data.feId);
42
+ node.setAttribute('value', data.value);
43
+ return node;
44
+ }
45
+ static value(domNode) {
46
+ return {
47
+ id: domNode.getAttribute('id'),
48
+ feId: domNode.getAttribute('feId'),
49
+ value: domNode.getAttribute('value'),
50
+ };
51
+ }
52
+ attach() {
53
+ super.attach();
54
+ if (!this.mounted) {
55
+ this.mounted = true;
56
+ this.clickHandler = this.getClickHandler;
57
+ this.domNode.addEventListener('click', this.clickHandler, false);
58
+ }
59
+ }
60
+ getClickHandler(event) {
61
+ event.stopPropagation();
62
+ }
63
+ }
64
+
65
+ const ImageFormat = Quill.import('formats/image');
66
+ class CustomImageBlot extends ImageFormat {
67
+ static create(value) {
68
+ const node = super.create(value);
69
+ node.classList.add('libs-ui-quill-format-image');
70
+ return node;
71
+ }
72
+ formats() {
73
+ return {}; // Tránh Quill tự động thêm thẻ `<span>`
74
+ }
75
+ }
76
+
77
+ const parchment = Quill.import('parchment');
78
+ const pixelLevels = [1, 2, 3, 4, 5, 6, 7, 8];
79
+ const tabMultiplier = 3;
80
+ class IndentAttributor extends parchment.Attributor.Style {
81
+ constructor(formatName, styleProperty, attributorOptions) {
82
+ super(formatName, styleProperty, attributorOptions);
83
+ }
84
+ add(node, value) {
85
+ return super.add(node, `${+value * tabMultiplier}em`);
86
+ }
87
+ value(node) {
88
+ return parseFloat(super.value(node)) / tabMultiplier || undefined; // Don't return NaN
89
+ }
90
+ }
91
+ const CustomIndentStyleBlot = new IndentAttributor('indent', 'margin-left', {
92
+ scope: parchment.Scope.BLOCK,
93
+ whitelist: pixelLevels.map((value) => `${value * tabMultiplier}em`),
94
+ });
95
+
27
96
  class LibsUiComponentsInputsQuillLinkComponent {
28
97
  dataLink = signal({ title: '', link: '' });
29
98
  patternLink = signal(patternUrl());
@@ -752,75 +821,6 @@ const insertContentWithRange = (content, savedRange, element) => {
752
821
  selection.addRange(savedRange);
753
822
  };
754
823
 
755
- const Block = Quill.import('blots/block');
756
- class QuillDivBlot extends Block {
757
- static tagName = 'div';
758
- }
759
-
760
- const Embed = Quill.import('blots/embed');
761
- class QuillMentionBlot extends Embed {
762
- static blotName = 'mention';
763
- static tagName = 'span';
764
- static className = 'libs-ui-quill-mention';
765
- static create(data) {
766
- const node = super.create();
767
- node.innerText += data.value;
768
- node.setAttribute('id', data.id);
769
- node.setAttribute('feId', data.feId);
770
- node.setAttribute('value', data.value);
771
- return node;
772
- }
773
- static value(domNode) {
774
- return {
775
- id: domNode.getAttribute('id'),
776
- feId: domNode.getAttribute('feId'),
777
- value: domNode.getAttribute('value'),
778
- };
779
- }
780
- attach() {
781
- super.attach();
782
- if (!this.mounted) {
783
- this.mounted = true;
784
- this.clickHandler = this.getClickHandler;
785
- this.domNode.addEventListener('click', this.clickHandler, false);
786
- }
787
- }
788
- getClickHandler(event) {
789
- event.stopPropagation();
790
- }
791
- }
792
-
793
- const ImageFormat = Quill.import('formats/image');
794
- class CustomImageBlot extends ImageFormat {
795
- static create(value) {
796
- const node = super.create(value);
797
- node.classList.add('libs-ui-quill-format-image');
798
- return node;
799
- }
800
- formats() {
801
- return {}; // Tránh Quill tự động thêm thẻ `<span>`
802
- }
803
- }
804
-
805
- const parchment = Quill.import('parchment');
806
- const pixelLevels = [1, 2, 3, 4, 5, 6, 7, 8];
807
- const tabMultiplier = 3;
808
- class IndentAttributor extends parchment.Attributor.Style {
809
- constructor(formatName, styleProperty, attributorOptions) {
810
- super(formatName, styleProperty, attributorOptions);
811
- }
812
- add(node, value) {
813
- return super.add(node, `${+value * tabMultiplier}em`);
814
- }
815
- value(node) {
816
- return parseFloat(super.value(node)) / tabMultiplier || undefined; // Don't return NaN
817
- }
818
- }
819
- const CustomIndentStyleBlot = new IndentAttributor('indent', 'margin-left', {
820
- scope: parchment.Scope.BLOCK,
821
- whitelist: pixelLevels.map((value) => `${value * tabMultiplier}em`),
822
- });
823
-
824
824
  /* eslint-disable @typescript-eslint/no-explicit-any */
825
825
  class LibsUiComponentsInputsQuillComponent {
826
826
  qlEditorElement = signal(undefined);
@@ -1447,7 +1447,6 @@ class LibsUiComponentsInputsQuillComponent {
1447
1447
  element.setAttribute('style', item.style);
1448
1448
  return;
1449
1449
  }
1450
- // Fixbug issue: https://admin-cv.mobio.vn/issues/49092
1451
1450
  let styleExist = element.getAttribute('style');
1452
1451
  if (styleExist) {
1453
1452
  ['font-family: Arial', 'font-family: sans-serif', 'font-family: serif', 'font-family: monospace', 'font-family: Helvetica'].forEach((font) => {