@innovastudio/contentbuilder 1.4.59 → 1.4.61

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.
@@ -4744,8 +4744,13 @@ class Util {
4744
4744
  }
4745
4745
  row.parentNode.insertBefore(rowElement, row);
4746
4746
  dom.moveAfter(rowElement, row);
4747
+
4748
+ // checkEmpty & onRender called here
4747
4749
  let builderActive = this.builder.doc.querySelector('.builder-active');
4748
- if (builderActive) this.builder.applyBehaviorOn(builderActive);
4750
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);else {
4751
+ builderActive = this.builder.doc.querySelector('.is-builder');
4752
+ this.builder.applyBehaviorOn(builderActive);
4753
+ }
4749
4754
  cellElement.click(); //change active block to the newly created
4750
4755
 
4751
4756
  // Change to row selection
@@ -7545,7 +7550,7 @@ class Dom {
7545
7550
  for (var i = 0; i < sel.rangeCount; ++i) {
7546
7551
  selectedNodes = selectedNodes.concat(sel.getRangeAt(i).getNodes());
7547
7552
  }
7548
- const blockElms = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'pre'];
7553
+ const blockElms = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'pre', 'li'];
7549
7554
  selectedNodes.forEach(item => {
7550
7555
  if (item.tagName) {
7551
7556
  const tagName = item.tagName.toLowerCase();
@@ -15828,6 +15833,15 @@ const prepareSvgIcons = builder => {
15828
15833
  <path d="M12 4l0 12"></path>
15829
15834
  </symbol>
15830
15835
 
15836
+ <symbol id="icon-message-search" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
15837
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
15838
+ <path d="M8 9h8"></path>
15839
+ <path d="M8 13h5"></path>
15840
+ <path d="M12 21l-.5 -.5l-2.5 -2.5h-3a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v4.5"></path>
15841
+ <path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
15842
+ <path d="M20.2 20.2l1.8 1.8"></path>
15843
+ </symbol>
15844
+
15831
15845
  </defs>
15832
15846
  </svg>`;
15833
15847
  builder.dom.appendHtml(builder.builderStuff, html);
@@ -18188,6 +18202,7 @@ class Grid {
18188
18202
  this.builder.uo.saveForUndo();
18189
18203
  row.parentNode.removeChild(row);
18190
18204
  util.checkEmpty();
18205
+ util.clearActiveCell();
18191
18206
  this.builder.opts.onChange();
18192
18207
  }
18193
18208
  });
@@ -76372,6 +76387,7 @@ class Lib {
76372
76387
 
76373
76388
  // Run functions based on short command
76374
76389
  processShortCommand(command) {
76390
+ command = command.toLowerCase();
76375
76391
  let shortCommandList = this.builder.shortCommandList;
76376
76392
  const getMatchingCommand = command => {
76377
76393
  for (const key in shortCommandList) {
@@ -76548,11 +76564,19 @@ class Lib {
76548
76564
  }
76549
76565
  if (val === 'left') {
76550
76566
  container.classList.add('is-content-left');
76551
- container.classList.add('edge-x-2');
76567
+ if (activeBox.querySelector('.glide')) {
76568
+ container.classList.add('edge-x-3'); // to give space for slider arrow
76569
+ } else {
76570
+ container.classList.add('edge-x-2');
76571
+ }
76552
76572
  }
76553
76573
  if (val === 'right') {
76554
76574
  container.classList.add('is-content-right');
76555
- container.classList.add('edge-x-2');
76575
+ if (activeBox.querySelector('.glide')) {
76576
+ container.classList.add('edge-x-3'); // to give space for slider arrow
76577
+ } else {
76578
+ container.classList.add('edge-x-2');
76579
+ }
76556
76580
  }
76557
76581
  if (val === 'top' || val === 'middle' || val === 'bottom') {
76558
76582
  activeBox.classList.remove('is-content-top');
@@ -77194,16 +77218,110 @@ class Dictation {
77194
77218
  this.util = util;
77195
77219
  const builderStuff = this.builder.builderStuff;
77196
77220
  this.builderStuff = builderStuff;
77221
+ const commandInfo = this.builder.commandInfo;
77222
+ let htmlList = '';
77223
+ for (const key in commandInfo) {
77224
+ if (Object.prototype.hasOwnProperty.call(commandInfo, key)) {
77225
+ const {
77226
+ title,
77227
+ list,
77228
+ width
77229
+ } = commandInfo[key];
77230
+ htmlList += `<h2>${title}</h2>`;
77231
+ for (const item of list) {
77232
+ if (width) htmlList += `<div role="button" tabindex="0" class="command-item" style="width:${width}">${item}</div>`;else htmlList += `<div role="button" tabindex="0" class="command-item">${item}</div>`;
77233
+ }
77234
+ }
77235
+ }
77197
77236
  let html = `
77198
77237
  <style>
77238
+ .is-modal.commandlist {
77239
+ z-index: 10005 !important
77240
+ }
77241
+ .is-modal.commandlist .is-modal-content {
77242
+ max-width:calc(100% - 150px);
77243
+ height:calc(100% - 150px);
77244
+ padding:0 !important;
77245
+ }
77246
+ .is-modal.commandlist .is-modal-close {
77247
+ position: absolute !important;
77248
+ top: 5px;
77249
+ right: 15px;
77250
+ box-shadow: none !important;
77251
+ }
77252
+ .is-modal.commandlist .is-modal-close {
77253
+ background: transparent !important;
77254
+ }
77255
+ .is-modal.commandlist .is-modal-close svg {
77256
+ width:50px;height:50px;
77257
+ }
77258
+ .is-modal.commandlist .is-modal-content > div {
77259
+ display: flex;
77260
+ flex-flow: wrap;
77261
+ align-items: flex-start;
77262
+ /*align-items: inherits;*/
77263
+ justify-content: flex-start;
77264
+ padding: 2.2rem;
77265
+ box-sizing: border-box;
77266
+ overflow-y: auto;
77267
+ overflow-x: hidden;
77268
+ width: 100%;
77269
+ height: 100%;
77270
+ }
77271
+ .is-modal.commandlist .is-modal-content > div > h2 {
77272
+ display: block;
77273
+ width: 100%;
77274
+ flex: none;
77275
+ font-family: "Open Sans", sans-serif;
77276
+ font-weight: 300;
77277
+ margin-bottom: 30px;
77278
+ font-size: 28px;
77279
+ }
77280
+ .is-modal.commandlist .is-modal-content > div > div {
77281
+ margin-right: 2.2rem;
77282
+ margin-bottom: 2.2rem;
77283
+ display: flex;
77284
+ flex: none;
77285
+ width: 255px;
77286
+ height: auto;
77287
+ flex-direction: column;
77288
+ justify-content: space-between;
77289
+ border-radius: 0.25rem;
77290
+ border: 1px solid rgb(156 163 175/.75);
77291
+ padding: 1.5rem 2rem;
77292
+ letter-spacing: .025em;
77293
+ box-shadow: 5px 5px 0px rgb(0 0 0 / 3%);
77294
+ font-size: 20px;
77295
+ font-weight: 300;
77296
+ font-family: sans-serif;
77297
+ line-height: 1.3;
77298
+ cursor:pointer;
77299
+ transition: all 0.3s ease;
77300
+ }
77301
+ /*
77302
+ .is-modal.commandlist .is-modal-content > div > div:focus {
77303
+ outline: #5fa1f0 2px solid;
77304
+ outline-offset: 2px;
77305
+ }
77306
+ */
77307
+ .is-modal.commandlist .is-modal-content > div > div:hover {
77308
+ background: rgba(0, 0, 0, 0.03);
77309
+ /*
77310
+ outline: #5fa1f0 2px solid;
77311
+ border: 1px solid transparent;
77312
+ */
77313
+ }
77314
+ .dark .is-modal.commandlist .is-modal-content > div > div:hover {
77315
+ background: rgba(255, 255, 255, 0.05);
77316
+ }
77199
77317
  .is-modal.page-command {
77200
- width: 300px !important;
77318
+ width: 340px !important;
77201
77319
  height: 200px !important;
77202
77320
  top: auto !important;
77203
77321
  bottom: 30px !important;
77204
77322
  left: auto !important;
77205
77323
  right: 30px !important;
77206
- z-index: 10002 !important;
77324
+ z-index: 10005 !important;
77207
77325
  font-size: 12px;
77208
77326
  }
77209
77327
  .page-command-overlay {
@@ -77214,9 +77332,6 @@ class Dictation {
77214
77332
  justify-content: center;
77215
77333
  align-items:center;
77216
77334
  }
77217
- .is-modal.page-command {
77218
- z-index: 10005 !important;
77219
- }
77220
77335
 
77221
77336
  .spinner {
77222
77337
  -webkit-animation: rotator 1.4s linear infinite;
@@ -77285,17 +77400,20 @@ class Dictation {
77285
77400
  align-items: center;">
77286
77401
  ${util.out('Send a Command')}</span>
77287
77402
  <button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
77288
- <svg class="is-icon-flex" style="width:23px;height:23px;"><use xlink:href="#ion-ios-close-empty"></use></svg>
77403
+ <svg class="is-icon-flex"><use xlink:href="#ion-ios-close-empty"></use></svg>
77289
77404
  </button>
77290
77405
  </div>
77291
77406
  <div style="display:flex;flex-direction:column;justify-content:space-between;position:absolute;box-sizing:border-box;top:0;left:0;width:100%;height:100%;border-top:transparent 35px solid;overflow-y:hidden;overflow-x:auto;">
77292
77407
 
77293
- <textarea class="inp-command" style="width:100%;height:121px;border:none;outline:none;background:transparent;line-height: 1.2;
77408
+ <textarea class="inp-command" style="resize:none;width:100%;height:121px;border:none;outline:none;background:transparent;line-height: 1.2;
77294
77409
  font-family: sans-serif;font-weight: 300;font-size: 17px;"></textarea>
77295
77410
  <div style="display:flex">
77296
77411
  <button title="${util.out('Mic')}" class="cmd-enable-dictation classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
77297
77412
  <svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-microphone"></use></svg>
77298
77413
  </button>
77414
+ <button title="${util.out('Commands')}" class="cmd-command-list classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
77415
+ <svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-message-search"></use></svg>
77416
+ </button>
77299
77417
  <button title="${util.out('Clear')}" class="cmd-clear-command classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
77300
77418
  <svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-eraser"></use></svg>
77301
77419
  </button>
@@ -77304,13 +77422,31 @@ class Dictation {
77304
77422
  </div>
77305
77423
  </div>
77306
77424
  </div>
77425
+
77426
+ <div class="is-modal commandlist" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="false">
77427
+ <div class="is-modal-overlay"></div>
77428
+
77429
+ <div class="is-modal-content scroll-darker"">
77430
+ <button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
77431
+ <svg class="is-icon-flex"><use xlink:href="#ion-ios-close-empty"></use></svg>
77432
+ </button>
77433
+ <div>
77434
+
77435
+ ${htmlList}
77436
+
77437
+ </div>
77438
+ </div>
77439
+ </div>
77307
77440
  `;
77308
77441
  dom.appendHtml(builderStuff, html);
77309
77442
  const modalCommand = builderStuff.querySelector('.page-command');
77310
77443
  this.modalCommand = modalCommand;
77444
+ const modalCommandList = builderStuff.querySelector('.commandlist');
77445
+ this.modalCommandList = modalCommandList;
77311
77446
  const btnDictation = builderStuff.querySelector('.cmd-enable-dictation');
77312
77447
  const btnClear = builderStuff.querySelector('.cmd-clear-command');
77313
77448
  const chkAutoSend = builderStuff.querySelector('#chkAutoSendCommand');
77449
+ const btnCommandList = builderStuff.querySelector('.cmd-command-list');
77314
77450
  this.builder.commandText = '';
77315
77451
  this.builder.autoSendCommand = false;
77316
77452
  if (localStorage.getItem('_dictation') !== null) {
@@ -77343,6 +77479,35 @@ class Dictation {
77343
77479
  util.saveSelection(); // must be called in case used by formatText()
77344
77480
  });
77345
77481
 
77482
+ btnCommandList.addEventListener('click', () => {
77483
+ util.showModal(this.modalCommandList, false, () => {
77484
+ btnCommandList.removeAttribute('data-focus');
77485
+ btnCommandList.focus();
77486
+ }, false);
77487
+ btnCommandList.setAttribute('data-focus', true);
77488
+ });
77489
+ const handleSelect = s => {
77490
+ const inpCommand = this.builderStuff.querySelector('.inp-command');
77491
+ inpCommand.value = s;
77492
+ util.hideModal(this.modalCommandList);
77493
+ };
77494
+ let items = modalCommandList.querySelectorAll('.command-item');
77495
+ items.forEach(elm => {
77496
+ elm.addEventListener('click', () => {
77497
+ handleSelect(elm.innerText);
77498
+ inpCommand.focus();
77499
+ });
77500
+ elm.addEventListener('keydown', e => {
77501
+ if (e.which === 13 && !e.shiftKey) {
77502
+ e.preventDefault();
77503
+ e.stopImmediatePropagation();
77504
+ handleSelect(elm.innerText);
77505
+ setTimeout(() => {
77506
+ inpCommand.focus();
77507
+ }, 300);
77508
+ }
77509
+ });
77510
+ });
77346
77511
  btnDictation.addEventListener('click', () => {
77347
77512
  if (!this.checkMic()) {
77348
77513
  this.startDictation();
@@ -77378,7 +77543,6 @@ class Dictation {
77378
77543
  // Abort
77379
77544
 
77380
77545
  this.opts.abort();
77381
- this.finish();
77382
77546
  return;
77383
77547
  }
77384
77548
  const inpCommand = this.modalCommand.querySelector('.inp-command');
@@ -77511,7 +77675,7 @@ class Dictation {
77511
77675
  ovl.style.display = 'flex';
77512
77676
  this.builder.isInProgress = true;
77513
77677
  }
77514
- finish() {
77678
+ finish(doNotClear) {
77515
77679
  const btnSend = this.modalCommand.querySelector('.cmd-send-command');
77516
77680
  btnSend.innerText = this.util.out('Send');
77517
77681
  const ovl = this.builderStuff.querySelector('.page-command-overlay');
@@ -77520,231 +77684,11 @@ class Dictation {
77520
77684
  if (this.builder.autoSendCommand) {
77521
77685
  // Clear
77522
77686
  const inpCommand = this.builderStuff.querySelector('.inp-command');
77523
- this.builder.commandText = '';
77524
- inpCommand.value = '';
77525
- }
77526
- const elmTool = this.builderStuff.querySelector('.is-element-tool');
77527
- elmTool.style.display = '';
77528
- }
77529
- }
77530
-
77531
- class Command {
77532
- constructor(builder) {
77533
- this.builder = builder;
77534
- const builderStuff = this.builder.builderStuff;
77535
- this.builderStuff = builderStuff;
77536
- const controller = new AbortController(); // Abort
77537
- let signal = controller.signal;
77538
-
77539
- // Dictation Panel
77540
- this.dictation = this.builder.dictation;
77541
- this.dictation.opts.send = async question => {
77542
- if (question === '') {
77543
- return;
77544
- }
77545
- question = this.builder.lib.processShortCommand(question);
77546
- if (!question) {
77547
- this.dictation.finish(); // Must be called after finished
77548
- return;
77687
+ if (doNotClear) ; else {
77688
+ this.builder.commandText = '';
77689
+ inpCommand.value = '';
77549
77690
  }
77550
- question = this.processPrompt(question);
77551
- if (!question) {
77552
- this.dictation.finish(); // Must be called after finished
77553
- return;
77554
- }
77555
- let currentHtml = this.builder.html();
77556
-
77557
- // Update prompt
77558
- question = `${question}:
77559
-
77560
- ${currentHtml}`;
77561
- const response = await fetch('http://localhost:8081/answer', {
77562
- signal,
77563
- // Abort
77564
- method: 'POST',
77565
- headers: {
77566
- 'Content-Type': 'application/json'
77567
- },
77568
- body: JSON.stringify({
77569
- question
77570
- })
77571
- });
77572
- if (!response.ok) {
77573
- const error = await response.json();
77574
- console.error('Error:', error.error);
77575
- this.dictation.finish(); // Must be called after finished
77576
-
77577
- return;
77578
- }
77579
- const data = await response.json();
77580
- let html = this.getHtmlResult(data.answer);
77581
- this.builder.saveForUndo();
77582
-
77583
- // Update HTML
77584
- this.builder.loadHtml(html);
77585
-
77586
- //Trigger Change event
77587
- this.builder.settings.onChange();
77588
- this.dictation.finish(); // Must be called after finished
77589
- };
77590
-
77591
- this.dictation.opts.abort = () => {
77592
- // console.log('abort');
77593
-
77594
- controller.abort();
77595
- this.dictation.finish(); // Must be called after finished
77596
- };
77597
- }
77598
-
77599
- //-------------------
77600
-
77601
- processPrompt(question) {
77602
- const activeBox = this.builder.activeBox;
77603
- let intent = this.builder.similarity.check(question);
77604
- // console.log(intent);
77605
-
77606
- if (!intent) return question;
77607
- if (intent === 'add_bg_color' || intent === 'change_bg_color' || intent === 'suggest_headline') {
77608
- return question; // Pass to ChatGPT
77609
- }
77610
-
77611
- this.builder.saveForUndo();
77612
- if (intent === 'move_row_up') {
77613
- this.builder.moveRowUp();
77614
- } else if (intent === 'move_row_down') {
77615
- this.builder.moveRowDown();
77616
- } else if (intent === 'duplicate_row') {
77617
- this.builder.duplicateRow();
77618
- } else if (intent === 'remove_row') {
77619
- this.builder.removeRow();
77620
- } else if (intent === 'move_col_left') {
77621
- this.builder.moveColumnLeft();
77622
- } else if (intent === 'move_col_right') {
77623
- this.builder.moveColumnRight();
77624
- } else if (intent === 'duplicate_col') {
77625
- this.builder.duplicateColumn();
77626
- } else if (intent === 'remove_col') {
77627
- this.builder.removeColumn();
77628
- } else if (intent === 'move_column_up') {
77629
- this.builder.moveColumnUp();
77630
- } else if (intent === 'move_column_down') {
77631
- this.builder.moveColumnDown();
77632
- } else if (intent === 'add_headline') {
77633
- this.builder.lib.addBlock(activeBox, 'headline', 'after');
77634
- } else if (intent === 'add_paragraph') {
77635
- this.builder.lib.addBlock(activeBox, 'paragraph', 'after');
77636
- } else if (intent === 'add_image') {
77637
- this.builder.lib.addBlock(activeBox, 'image', 'after');
77638
- } else if (intent === 'add_youtube') {
77639
- this.builder.lib.addBlock(activeBox, 'youtube', 'after');
77640
- } else if (intent === 'add_video') {
77641
- this.builder.lib.addBlock(activeBox, 'video', 'after');
77642
- } else if (intent === 'add_audio') {
77643
- this.builder.lib.addBlock(activeBox, 'audio', 'after');
77644
- } else if (intent === 'add_map') {
77645
- this.builder.lib.addBlock(activeBox, 'map', 'after');
77646
- } else if (intent === 'add_table') {
77647
- this.builder.lib.addBlock(activeBox, 'table', 'after');
77648
- } else if (intent === 'add_social') {
77649
- this.builder.lib.addBlock(activeBox, 'social', 'after');
77650
- } else if (intent === 'add_icon') {
77651
- this.builder.lib.addBlock(activeBox, 'icon', 'after');
77652
- } else if (intent === 'add_button') {
77653
- this.builder.lib.addBlock(activeBox, 'button', 'after');
77654
- } else if (intent === 'add_2buttons') {
77655
- this.builder.lib.addBlock(activeBox, 'twobuttons', 'after');
77656
- } else if (intent === 'add_space') {
77657
- this.builder.lib.addBlock(activeBox, 'space', 'after');
77658
- } else if (intent === 'increase_font_size') {
77659
- let elm = this.builder.activeElement;
77660
- if (elm) {
77661
- this.builder.lib.increaseFontSize(elm);
77662
- }
77663
- } else if (intent === 'decrease_font_size') {
77664
- let elm = this.builder.activeElement;
77665
- if (elm) {
77666
- this.builder.lib.decreaseFontSize(elm);
77667
- }
77668
- } else if (intent === 'clear_font_size') {
77669
- let elm = this.builder.activeElement;
77670
- if (elm) {
77671
- this.builder.lib.clearFontSize(elm);
77672
- }
77673
- } else if (intent === 'align_left') {
77674
- let elm = this.builder.activeElement;
77675
- if (elm) {
77676
- this.builder.lib.alignText(elm, 'left');
77677
- } else {
77678
- this.builder.lib.alignContent(activeBox, 'left');
77679
- }
77680
- } else if (intent === 'align_center') {
77681
- let elm = this.builder.activeElement;
77682
- if (elm) {
77683
- this.builder.lib.alignText(elm, 'center');
77684
- } else {
77685
- this.builder.lib.alignContent(activeBox, 'center');
77686
- }
77687
- } else if (intent === 'align_right') {
77688
- let elm = this.builder.activeElement;
77689
- if (elm) {
77690
- this.builder.lib.alignText(elm, 'right');
77691
- } else {
77692
- this.builder.lib.alignContent(activeBox, 'right');
77693
- }
77694
- } else if (intent === 'align_full') {
77695
- let elm = this.builder.activeElement;
77696
- if (elm) {
77697
- this.builder.lib.alignText(elm, 'justify');
77698
- } else {
77699
- this.builder.lib.alignContent(activeBox, 'justify');
77700
- }
77701
- } else if (intent === 'clear_alignment') {
77702
- let elm = this.builder.activeElement;
77703
- if (elm) {
77704
- this.builder.lib.alignText(elm, '');
77705
- } else {
77706
- this.builder.lib.alignContent(activeBox, '');
77707
- }
77708
- } else if (intent === 'increase_space') {
77709
- let elm = this.builder.activeElement;
77710
- if (elm) {
77711
- this.builder.lib.increaseElementHeight(elm);
77712
- }
77713
- } else if (intent === 'decrease_space') {
77714
- let elm = this.builder.activeElement;
77715
- if (elm) {
77716
- this.builder.lib.decreaseElementHeight(elm);
77717
- }
77718
- } else if (intent === 'increase_line_height') {
77719
- let elm = this.builder.activeElement;
77720
- if (elm) {
77721
- this.builder.lib.increaseLineHeight(elm);
77722
- }
77723
- } else if (intent === 'decrease_line_height') {
77724
- let elm = this.builder.activeElement;
77725
- if (elm) {
77726
- this.builder.lib.decreaseLineHeight(elm);
77727
- }
77728
- }
77729
-
77730
- //Trigger Change event
77731
- this.builder.settings.onChange();
77732
- return false;
77733
- } // /processPrompt()
77734
-
77735
- //-------------------
77736
-
77737
- openDictation() {
77738
- this.dictation.openDictation();
77739
- }
77740
- getHtmlResult(html) {
77741
- if (html.indexOf('```') !== -1) {
77742
- const regex = /<div[^>]*>[\s\S]*<\/div>/;
77743
- const matches = html.match(regex);
77744
- const extractedString = matches && matches[0];
77745
- html = extractedString;
77746
77691
  }
77747
- return html;
77748
77692
  }
77749
77693
  }
77750
77694
 
@@ -77827,11 +77771,12 @@ class Similarity {
77827
77771
  for (const [key, value] of Object.entries(commandList)) {
77828
77772
  const similarity = this.calculate(command, value);
77829
77773
  if (similarity > maxSimilarity) {
77774
+ // console.log(key,similarity)
77830
77775
  maxSimilarity = similarity;
77831
77776
  maxKey = key;
77832
77777
  }
77833
77778
  }
77834
- const similarityThreshold = 0.5;
77779
+ const similarityThreshold = 0.6;
77835
77780
  if (maxSimilarity >= similarityThreshold) {
77836
77781
  return maxKey;
77837
77782
  }
@@ -78466,7 +78411,9 @@ class ContentBuilder {
78466
78411
  enableDragResize: true,
78467
78412
  simpleTextSettings: false,
78468
78413
  enableColumnsPerLine: true,
78414
+ /* Prompt/Command Stuff */
78469
78415
  isContentBox: false,
78416
+ sendCommandUrl: 'http://localhost:8081/answer',
78470
78417
  speechRecognitionLang: 'en-US',
78471
78418
  headlineList: ['We create simple and effective designs.', 'Ultimate Experiences With Story, Emotion, And Purpose.', 'Build Anything Beautifully', 'With Less Stuff and More Compassion', 'We\'re [CompanyName]. Full stack development with a spark of creativity.', 'Transforming your digital experience with [CompanyName]. Achieve your online goals with our customized solutions.', 'Revolutionizing web development with [CompanyName]. Unleash your digital potential with our high-performance solutions.', 'Creative and Inspiring'],
78472
78419
  shortCommandList: {
@@ -78486,17 +78433,38 @@ class ContentBuilder {
78486
78433
  clean: ['clean']
78487
78434
  },
78488
78435
  commandList: {
78489
- add_bg_color: ['add a background color', 'add background color'],
78490
- add_bg_image: ['add a background image', 'add background image', 'add a background', 'add background'],
78491
- change_bg_color: ['change the background color', 'change background color'],
78492
- change_bg_image: ['change the background image', 'change background image', 'change the background', 'change background'],
78493
- remove_bg_color: ['remove background color', 'remove the background color', 'clear background color', 'clear the background color'],
78494
- remove_bg: ['remove background', 'remove background image', 'remove the background', 'remove the background image', 'clear background', 'clear background image', 'clear the background', 'clear the background image'],
78436
+ select: ['select', 'select first'],
78437
+ select_next: ['select next', 'select after'],
78438
+ select_previous: ['select previous', 'select before'],
78439
+ select_last: ['select last'],
78440
+ select_headline: ['select headline'],
78441
+ select_paragraph: ['select paragraph'],
78442
+ select_button: ['select button'],
78443
+ select_space: ['select space'],
78444
+ select_image: ['select image'],
78445
+ change_font: ['change font', 'change typography', 'change style'],
78446
+ fade_in: ['fade in'],
78447
+ fade_in_slow: ['fade in slow'],
78448
+ fade_in_up: ['fade in up'],
78449
+ fade_in_up_slow: ['fade in up slow'],
78450
+ slide_up: ['slide up'],
78451
+ slide_up_slow: ['slide up slow'],
78452
+ zoom_in: ['zoom in'],
78453
+ zoom_out: ['zoom out'],
78454
+ animate_once: ['animate once'],
78455
+ always_animate: ['always animate'],
78456
+ remove_animation: ['remove animation', 'clear animation', 'remove fade in', 'clear fade in', 'remove slide up', 'clear slide up', 'remove zoom in', 'clear zoom in', 'remove zoom out', 'clear zoom out'],
78457
+ add_bg_color: ['add background color'],
78458
+ add_bg_image: ['add background image', 'add background'],
78459
+ change_bg_color: ['change background color'],
78460
+ change_bg_image: ['change background image', 'change background'],
78461
+ remove_bg_color: ['remove background color', 'clear background color'],
78462
+ remove_bg: ['remove background', 'remove background image', 'clear background', 'clear background image'],
78495
78463
  increase_content_width: ['increase content width', 'enlarge content width'],
78496
78464
  decrease_content_width: ['decrease content width', 'reduce content width'],
78497
78465
  clear_content_width: ['clear content width', 'remove content width', 'make content full', 'full width content'],
78498
- make_content_light: ['make the content white', 'make the content light', 'make the text white', 'make the text light', 'make content white', 'make content light', 'make text white', 'make text light', 'change the content white', 'change the content light', 'change the text white', 'change the text light', 'change to white content', 'change to light content', 'change to white text', 'change to light text'],
78499
- make_content_dark: ['make the content black', 'make the content dark', 'make the text black', 'make the text dark', 'make content black', 'make content dark', 'make text black', 'make text dark', 'change the content black', 'change the content dark', 'change the text black', 'change the text dark', 'change to black content', 'change to dark content', 'change to black text', 'change to dark text'],
78466
+ make_content_light: ['make content white', 'make content light', 'make text white', 'make text light', 'change content white', 'change content light', 'change text white', 'change text light', 'change to white content', 'change to light content', 'change to white text', 'change to light text'],
78467
+ make_content_dark: ['make content black', 'make content dark', 'make text black', 'make text dark', 'change content black', 'change content dark', 'change text black', 'change text dark', 'change to black content', 'change to dark content', 'change to black text', 'change to dark text'],
78500
78468
  make_section_height_10: ['make section height 10'],
78501
78469
  make_section_height_15: ['make section height 15'],
78502
78470
  make_section_height_20: ['make section height 20'],
@@ -78512,46 +78480,56 @@ class ContentBuilder {
78512
78480
  make_section_height_90: ['make section height 90'],
78513
78481
  make_section_height_100: ['make section height 100'],
78514
78482
  make_section_height_auto: ['make section height auto'],
78515
- suggest_headline: ['suggest a headline', 'suggest headline', 'suggest a header', 'suggest header', 'suggest a title', 'suggest title', 'write a headline', 'write headline', 'write a header', 'write header', 'write a title', 'write title'],
78516
- add_headline: ['add a headline', 'add headline', 'add a header', 'add header', 'add a title', 'add title'],
78517
- add_paragraph: ['add a paragraph', 'add paragraph'],
78518
- add_image: ['add an image', 'add image'],
78519
- add_youtube: ['add a youtube', 'add youtube'],
78520
- add_video: ['add a video', 'add video', 'add an HTML5 video', 'add HTML5 video', 'add an mp4 video', 'add mp4 video'],
78521
- add_audio: ['add an audio', 'add audio', 'add a music', 'add music', 'add an mp3', 'add mp3'],
78522
- add_map: ['add a map', 'add map', 'add a google map', 'add google map'],
78523
- add_table: ['add a table', 'add table'],
78524
- add_social: ['add a social', 'add social'],
78525
- add_icon: ['add an icon', 'add icon'],
78526
- add_button: ['add a button', 'add button'],
78527
- add_2buttons: ['add 2 button', 'add 2 button', 'add 2 buttons', 'add 2 buttons'],
78528
- add_space: ['add a space', 'add space'],
78483
+ suggest_headline: ['suggest headline', 'suggest header', 'suggest title', 'write headline', 'write header', 'write title'],
78484
+ suggest_tagline: ['suggest tagline', 'write tagline'],
78485
+ add_headline: ['add headline', 'add header', 'add title'],
78486
+ add_paragraph: ['add paragraph'],
78487
+ add_image: ['add image'],
78488
+ add_youtube: ['add youtube'],
78489
+ add_video: ['add video'],
78490
+ remove_video: ['remove video', 'clear video'],
78491
+ add_bg_video: ['add background video'],
78492
+ remove_bg_video: ['remove background video', 'clear background video'],
78493
+ add_slider: ['add slider'],
78494
+ remove_slider: ['remove slider', 'clear slider'],
78495
+ add_bg_slider: ['add background slider'],
78496
+ remove_bg_slider: ['remove background slider', 'clear background slider'],
78497
+ add_audio: ['add audio', 'add music', 'add mp3'],
78498
+ add_map: ['add map', 'add google map'],
78499
+ add_table: ['add table'],
78500
+ add_social: ['add social'],
78501
+ add_icon: ['add icon'],
78502
+ add_button: ['add button'],
78503
+ add_2buttons: ['add 2 button', 'add 2 buttons'],
78504
+ add_space: ['add space'],
78529
78505
  position_before: ['above', 'before'],
78530
- increase_line_height: ['increase line height', 'increase line spacing', 'increase text spacing', 'increase the line height', 'increase the line spacing', 'increase the text spacing', 'enlarge line height', 'enlarge line spacing', 'enlarge text spacing', 'enlarge the line height', 'enlarge the line spacing', 'enlarge the text spacing', 'bigger line height', 'bigger line spacing', 'bigger text spacing', 'bigger the line height', 'bigger the line spacing', 'bigger the text spacing', 'make line height bigger', 'make line spacing bigger', 'make text spacing bigger', 'make the line height bigger', 'make the line spacing bigger', 'make the text spacing bigger'],
78531
- increase_default_line_height: ['increase default line height', 'increase default line spacing', 'increase default text spacing', 'increase the default line height', 'increase the default line spacing', 'increase the default text spacing', 'enlarge default line height', 'enlarge default line spacing', 'enlarge default text spacing', 'enlarge the default line height', 'enlarge the default line spacing', 'enlarge the default text spacing', 'bigger default line height', 'bigger default line spacing', 'bigger default text spacing', 'bigger the default line height', 'bigger the default line spacing', 'bigger the default text spacing', 'make default line height bigger', 'make default line spacing bigger', 'make default text spacing bigger', 'make the default line height bigger', 'make the default line spacing bigger', 'make the default text spacing bigger'],
78532
- decrease_line_height: ['decrease line height', 'decrease line spacing', 'decrease text spacing', 'decrease the line height', 'decrease the line spacing', 'decrease the text spacing', 'reduce line height', 'reduce line spacing', 'reduce text spacing', 'reduce the line height', 'reduce the line spacing', 'reduce the text spacing', 'smaller line height', 'smaller line spacing', 'smaller text spacing', 'smaller the line height', 'smaller the line spacing', 'smaller the text spacing', 'make line height smaller', 'make line spacing smaller', 'make text spacing smaller', 'make the line height smaller', 'make the line spacing smaller', 'make the text spacing smaller'],
78533
- decrease_default_line_height: ['decrease default line height', 'decrease default line spacing', 'decrease default text spacing', 'decrease the default line height', 'decrease the default line spacing', 'decrease the default text spacing', 'reduce default line height', 'reduce default line spacing', 'reduce default text spacing', 'reduce the default line height', 'reduce the default line spacing', 'reduce the default text spacing', 'smaller default line height', 'smaller default line spacing', 'smaller default text spacing', 'smaller the default line height', 'smaller the default line spacing', 'smaller the default text spacing', 'make default line height smaller', 'make default line spacing smaller', 'make default text spacing smaller', 'make the default line height smaller', 'make the default line spacing smaller', 'make the default text spacing smaller'],
78534
- increase_font_size: ['increase font', 'increase size', 'increase font size', 'increase the font', 'increase the size', 'increase the font size', 'increase text', 'increase size', 'increase text size', 'increase the text', 'increase the text size', 'enlarge font', 'enlarge size', 'enlarge font size', 'enlarge the font', 'enlarge the size', 'enlarge the font size', 'enlarge text', 'enlarge size', 'enlarge text size', 'enlarge the text', 'enlarge the text size', 'text bigger', 'font bigger', 'size bigger'],
78535
- decrease_font_size: ['decrease font', 'decrease size', 'decrease font size', 'decrease the font', 'decrease the size', 'decrease the font size', 'decrease text', 'decrease size', 'decrease text size', 'decrease the text', 'decrease the text size', 'reduce font', 'reduce size', 'reduce font size', 'reduce the font', 'reduce the size', 'reduce the font size', 'reduce text', 'reduce size', 'reduce text size', 'reduce the text', 'reduce the text size', 'text smaller', 'font smaller', 'size smaller'],
78536
- increase_default_font_size: ['increase default font', 'increase default size', 'increase default font size', 'increase the default font', 'increase the default size', 'increase the default font size', 'increase default text', 'increase default size', 'increase default text size', 'increase the default text', 'increase the default text size', 'enlarge default font', 'enlarge default size', 'enlarge default font size', 'enlarge the default font', 'enlarge the default size', 'enlarge the default font size', 'enlarge default text', 'enlarge default text size', 'enlarge the default text', 'enlarge the default text size', 'default text bigger', 'default font bigger', 'default size bigger', 'increase default content', 'increase default content size', 'increase the default content', 'increase the default content size', 'enlarge default content', 'enlarge default content size', 'enlarge the default content', 'enlarge the default content size'],
78537
- decrease_default_font_size: ['decrease default font', 'decrease default size', 'decrease default font size', 'decrease the default font', 'decrease the default size', 'decrease the default font size', 'decrease default text', 'decrease default size', 'decrease default text size', 'decrease the default text', 'decrease the default text size', 'reduce default font', 'reduce default size', 'reduce default font size', 'reduce the default font', 'reduce the default size', 'reduce the default font size', 'reduce default text', 'reduce default text size', 'reduce the default text', 'reduce the default text size', 'default text smaller', 'default font smaller', 'default size smaller', 'decrease default content', 'decrease default content size', 'decrease the default content', 'decrease the default content size', 'reduce default content', 'reduce default content size', 'reduce the default content', 'reduce the default content size'],
78538
- clear_font_size: ['clear font size', 'remove font size', 'clear text size', 'remove text size', 'use default font size', 'ude the default font size'],
78539
- align_left: ['align left', 'align the text left', 'align text left', 'left aligned'],
78540
- align_center: ['align center', 'align the text center', 'align text center', 'center aligned'],
78541
- align_right: ['align right', 'align the text right', 'align text right', 'right aligned'],
78542
- align_full: ['align full', 'align justify', 'justify', 'justify text', 'justify the text', 'justify full'],
78543
- clear_alignment: ['clear alignment', 'remove alignment', 'clear the text alignment', 'remove the text alignment', 'clear text alignment', 'remove text alignment'],
78544
- make_content_centered: ['make the content center', 'make the content centered'],
78545
- move_content_left: ['move content left', 'move content to left', 'move the content left', 'move content to the left', 'move content to the left', 'place content on the left', 'move the content to the left', 'move the content to the left', 'place the content on the left'],
78546
- move_content_center: ['move content center', 'move content to center', 'move the content center', 'move content to the center', 'move content to the center', 'place content on the center', 'move the content to the center', 'move the content to the center', 'place the content on the center'],
78547
- move_content_right: ['move content right', 'move content to right', 'move the content right', 'move content to the right', 'move content to the right', 'place content on the right', 'move the content to the right', 'move the content to the right', 'place the content on the right'],
78548
- move_content_top: ['move content top', 'move content to top', 'move the content top', 'move content to the top', 'move content to the top', 'place content on the top', 'move the content to the top', 'move the content to the top', 'place the content on the top'],
78549
- move_content_middle: ['move content middle', 'move content to middle', 'move the content middle', 'move content to the middle', 'move content to the middle', 'place content on the middle', 'move the content to the middle', 'move the content to the middle', 'place the content on the middle'],
78550
- move_content_bottom: ['move content bottom', 'move content to bottom', 'move the content bottom', 'move content to the bottom', 'move content to the bottom', 'place content on the bottom', 'move the content to the bottom', 'move the content to the bottom', 'place the content on the bottom'],
78551
- increase_space: ['more space', 'increase space', 'increase the space', 'enlarge the space'],
78552
- decrease_space: ['less space', 'decrease space', 'decrease the space', 'reduce the space'],
78553
- move_row_up: ['move up', 'move row up'],
78554
- move_row_down: ['move down', 'move row down'],
78506
+ increase_line_height: ['increase line height', 'increase line spacing', 'increase text spacing', 'enlarge line height', 'enlarge line spacing', 'enlarge text spacing', 'bigger line height', 'bigger line spacing', 'bigger text spacing', 'make line height bigger', 'make line spacing bigger', 'make text spacing bigger'],
78507
+ increase_default_line_height: ['increase default line height', 'increase default line spacing', 'increase default text spacing', 'enlarge default line height', 'enlarge default line spacing', 'enlarge default text spacing', 'bigger default line height', 'bigger default line spacing', 'bigger default text spacing', 'make default line height bigger', 'make default line spacing bigger', 'make default text spacing bigger'],
78508
+ decrease_line_height: ['decrease line height', 'decrease line spacing', 'decrease text spacing', 'reduce line height', 'reduce line spacing', 'reduce text spacing', 'smaller line height', 'smaller line spacing', 'smaller text spacing', 'make line height smaller', 'make line spacing smaller', 'make text spacing smaller'],
78509
+ decrease_default_line_height: ['decrease default line height', 'decrease default line spacing', 'decrease default text spacing', 'reduce default line height', 'reduce default line spacing', 'reduce default text spacing', 'smaller default line height', 'smaller default line spacing', 'smaller default text spacing', 'make default line height smaller', 'make default line spacing smaller', 'make default text spacing smaller'],
78510
+ increase_font_size: ['increase font', 'increase size', 'increase font size', 'increase text', 'increase size', 'increase text size', 'enlarge font', 'enlarge size', 'enlarge font size', 'enlarge text', 'enlarge size', 'enlarge text size', 'text bigger', 'font bigger', 'size bigger'],
78511
+ decrease_font_size: ['decrease font', 'decrease size', 'decrease font size', 'decrease text', 'decrease size', 'decrease text size', 'reduce font', 'reduce size', 'reduce font size', 'reduce text', 'reduce size', 'reduce text size', 'text smaller', 'font smaller', 'size smaller'],
78512
+ increase_default_font_size: ['increase default font', 'increase default size', 'increase default font size', 'increase default text', 'increase default size', 'increase default text size', 'enlarge default font', 'enlarge default size', 'enlarge default font size', 'enlarge default text', 'enlarge default text size', 'default text bigger', 'default font bigger', 'default size bigger', 'increase default content', 'increase default content size', 'enlarge default content', 'enlarge default content size'],
78513
+ decrease_default_font_size: ['decrease default font', 'decrease default size', 'decrease default font size', 'decrease default text', 'decrease default size', 'decrease default text size', 'reduce default font', 'reduce default size', 'reduce default font size', 'reduce default text', 'reduce default text size', 'default text smaller', 'default font smaller', 'default size smaller', 'decrease default content', 'decrease default content size', 'reduce default content', 'reduce default content size'],
78514
+ clear_font_size: ['clear font size', 'remove font size', 'clear text size', 'remove text size', 'use default font size'],
78515
+ align_left: ['align left', 'align text left', 'left aligned'],
78516
+ align_center: ['align center', 'align text center', 'center aligned'],
78517
+ align_right: ['align right', 'align text right', 'right aligned'],
78518
+ align_full: ['align full', 'align justify', 'justify', 'justify text', 'justify full'],
78519
+ clear_alignment: ['clear alignment', 'remove alignment', 'clear text alignment', 'remove text alignment'],
78520
+ make_content_centered: ['make content center'],
78521
+ move_content_left: ['move content left', 'place content left'],
78522
+ move_content_center: ['move content center', 'place content center'],
78523
+ move_content_right: ['move content right', 'place content right'],
78524
+ move_content_top: ['move content top', 'place content top'],
78525
+ move_content_middle: ['move content middle', 'place content middle'],
78526
+ move_content_bottom: ['move content bottom', 'place content bottom'],
78527
+ increase_space: ['more space', 'increase space', 'enlarge space'],
78528
+ decrease_space: ['less space', 'decrease space', 'reduce space'],
78529
+ move_up: ['move up'],
78530
+ move_down: ['move down'],
78531
+ move_row_up: ['move row up'],
78532
+ move_row_down: ['move row down'],
78555
78533
  duplicate_row: ['duplicate row', 'copy row'],
78556
78534
  remove_row: ['remove row', 'delete row'],
78557
78535
  move_col_left: ['move left', 'move column left'],
@@ -78559,7 +78537,67 @@ class ContentBuilder {
78559
78537
  duplicate_col: ['duplicate column', 'copy column'],
78560
78538
  remove_col: ['remove column', 'delete column'],
78561
78539
  move_column_up: ['move column up'],
78562
- move_column_down: ['move column down']
78540
+ move_column_down: ['move column down'],
78541
+ move_section_up: ['move section up'],
78542
+ move_section_down: ['move section down'],
78543
+ move_section_top: ['move section top'],
78544
+ move_section_bottom: ['move section bottom'],
78545
+ duplicate_section: ['duplicate section', 'copy section'],
78546
+ remove_section: ['remove section', 'delete section'],
78547
+ remove_content: ['remove content', 'remove all text', 'remove all content', 'delete content', 'delete all text', 'delete all content', 'clear content', 'clear all text', 'clear all content'],
78548
+ add_content: ['add content', 'add text']
78549
+ },
78550
+ commandInfo: {
78551
+ general: {
78552
+ title: 'General',
78553
+ list: ['Let\'s redesign the layout to enhance its visual appeal and user experience.', 'Rewrite all the text to improve the overall copywriting quality.', 'Can you come up with another rendition of the content or offer an alternative wording?', 'Can you suggest a captivating headline for us?', 'Undo', 'Redo']
78554
+ // width: '400px'
78555
+ },
78556
+
78557
+ selection: {
78558
+ title: 'Selection',
78559
+ list: ['Select the headline',
78560
+ // 'Select the paragraph',
78561
+ // 'Select the button',
78562
+ // 'Select the space',
78563
+ // 'Select the image',
78564
+ 'Select the next block',
78565
+ // 'Select the previous block',
78566
+ // 'Select the first block',
78567
+ // 'Select the last block',
78568
+ 'Move up', 'Move down', 'Duplicate row', 'Remove row', 'Move column left', 'Move column right', 'Duplicate column', 'Remove column'
78569
+ // 'Move column up',
78570
+ // 'Move column down',
78571
+ ]
78572
+ },
78573
+
78574
+ element: {
78575
+ title: 'Element',
78576
+ list: ['Add a paragraph', 'Add an image', 'Add a youtube',
78577
+ // 'Add a table',
78578
+ // 'Add audio',
78579
+ // 'Add map',
78580
+ // 'Add an icon',
78581
+ // 'Add social links',
78582
+ 'Add a button', 'Add two buttons', 'Add a space', 'Increase the space', 'Reduce the space']
78583
+ },
78584
+ text: {
78585
+ title: 'Text Formatting',
78586
+ list: [
78587
+ // 'Increase', 'Bigger','Larger','Enlarge',
78588
+ // 'Decrease', 'Smaller',
78589
+ 'Increase font size',
78590
+ // 'Decrease font size',
78591
+ 'Clear font size',
78592
+ // 'Align left',
78593
+ 'Align center', 'Align right', 'Align justify', 'Clear alignment', 'Bold', 'Italic', 'Underline', 'Strikethrough',
78594
+ // 'Superscript',
78595
+ // 'Subscript',
78596
+ 'Uppercase',
78597
+ // 'Lowercase',
78598
+ // 'Capitalize',
78599
+ 'Clean']
78600
+ }
78563
78601
  }
78564
78602
  };
78565
78603
 
@@ -78847,12 +78885,20 @@ class ContentBuilder {
78847
78885
  this.ShortcutInfo = new ShortcutInfo(this);
78848
78886
 
78849
78887
  // Prompt Stuff
78888
+ if (!this.opts.isContentBox) {
78889
+ if (localStorage.getItem('_dictation') !== null) {
78890
+ localStorage.removeItem('_dictation');
78891
+ }
78892
+ }
78850
78893
  this.dictation = new Dictation({}, this); // Dictation Panel
78851
78894
  this.lib = new Lib(this); // Libraries of common editing functions
78852
78895
  this.similarity = new Similarity(this);
78853
- if (!this.opts.isContentBox) {
78854
- this.command = new Command(this);
78896
+ /*
78897
+ if(!this.opts.isContentBox) {
78898
+ this.command = new Command(this);
78855
78899
  }
78900
+ */
78901
+
78856
78902
  if (this.iframe) {
78857
78903
  this.win.addEventListener('scroll', this.doWindowScroll = () => {
78858
78904
  this.util.hidePops();