keevo-components 2.0.276 → 2.0.277

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.
@@ -5143,6 +5143,31 @@ class KvEditorQuillService {
5143
5143
  Quill.register(Font, true);
5144
5144
  Quill.register(Size, true);
5145
5145
  Quill.register(AlignStyle, true);
5146
+ // Registra formato customizado para as variáveis inseridas
5147
+ const Inline = Quill.import('blots/inline');
5148
+ class VariavelBlot extends Inline {
5149
+ static { this.blotName = 'variavel'; }
5150
+ static { this.tagName = 'span'; }
5151
+ static { this.className = 'variavel-inserida'; }
5152
+ static create(value) {
5153
+ let node = super.create();
5154
+ node.setAttribute('class', 'variavel-inserida');
5155
+ node.setAttribute('style', 'background-color: #e6f7ff; color: #0066cc; border-radius: 3px; padding: 2px 4px; font-weight: 500;');
5156
+ if (typeof value === 'object' && value && value.title) {
5157
+ node.setAttribute('title', value.title);
5158
+ }
5159
+ else if (typeof value === 'string') {
5160
+ node.setAttribute('title', value);
5161
+ }
5162
+ return node;
5163
+ }
5164
+ static formats(node) {
5165
+ return {
5166
+ title: node.getAttribute('title') || ''
5167
+ };
5168
+ }
5169
+ }
5170
+ Quill.register(VariavelBlot, true);
5146
5171
  }
5147
5172
  /**
5148
5173
  * Cria uma instância do Quill com a configuração fornecida
@@ -5928,6 +5953,54 @@ class KvEditorComponent extends BaseComponentInput {
5928
5953
  return delta;
5929
5954
  }]
5930
5955
  ]
5956
+ },
5957
+ keyboard: {
5958
+ bindings: {
5959
+ backspaceVariable: {
5960
+ key: 'Backspace',
5961
+ collapsed: true,
5962
+ handler: (range, context) => {
5963
+ if (range.index === 0)
5964
+ return true;
5965
+ const [leaf] = this.quill.getLeaf(range.index - 1);
5966
+ if (leaf && leaf.parent && leaf.parent.statics.blotName === 'variavel') {
5967
+ const blotOffset = this.quill.getIndex(leaf.parent);
5968
+ const blotLength = leaf.parent.length();
5969
+ this.quill.deleteText(blotOffset, blotLength, 'user');
5970
+ return false;
5971
+ }
5972
+ return true;
5973
+ }
5974
+ },
5975
+ deleteVariable: {
5976
+ key: 'Delete',
5977
+ collapsed: true,
5978
+ handler: (range, context) => {
5979
+ const [leaf] = this.quill.getLeaf(range.index);
5980
+ if (leaf && leaf.parent && leaf.parent.statics.blotName === 'variavel') {
5981
+ const blotOffset = this.quill.getIndex(leaf.parent);
5982
+ const blotLength = leaf.parent.length();
5983
+ this.quill.deleteText(blotOffset, blotLength, 'user');
5984
+ return false;
5985
+ }
5986
+ return true;
5987
+ }
5988
+ },
5989
+ spaceVariable: {
5990
+ key: ' ',
5991
+ collapsed: true,
5992
+ handler: (range, context) => {
5993
+ const [leaf] = this.quill.getLeaf(range.index);
5994
+ if (leaf && leaf.parent && leaf.parent.statics.blotName === 'variavel') {
5995
+ return false;
5996
+ }
5997
+ if (context.format && context.format.variavel) {
5998
+ return false;
5999
+ }
6000
+ return true;
6001
+ }
6002
+ }
6003
+ }
5931
6004
  }
5932
6005
  },
5933
6006
  placeholder: this.label ? this.label : '',