@innovastudio/contentbuilder 1.4.87 → 1.4.89
Sign up to get free protection for your applications and to get access to all the features.
@@ -5554,6 +5554,12 @@ class Util {
|
|
5554
5554
|
localStorage.removeItem('_mic');
|
5555
5555
|
localStorage.removeItem('_autosendcommand');
|
5556
5556
|
localStorage.removeItem('_sampleshown');
|
5557
|
+
localStorage.removeItem('_disclaimershown');
|
5558
|
+
localStorage.removeItem('_temp');
|
5559
|
+
localStorage.removeItem('_top_p');
|
5560
|
+
localStorage.removeItem('_autosend_delay');
|
5561
|
+
localStorage.removeItem('_auto_editblock');
|
5562
|
+
localStorage.removeItem('_command_lang');
|
5557
5563
|
|
5558
5564
|
//NOT USED
|
5559
5565
|
localStorage.removeItem('_scrollableeditor');
|
@@ -51648,16 +51654,16 @@ class ButtonEditor {
|
|
51648
51654
|
const val = btn.getAttribute('data-command');
|
51649
51655
|
const activeButton = this.builder.activeButton || this.builder.activeLinkButton;
|
51650
51656
|
if (val === 'auto') {
|
51651
|
-
|
51652
|
-
|
51653
|
-
|
51654
|
-
|
51657
|
+
activeButton.classList.remove('flex');
|
51658
|
+
activeButton.classList.remove('justify-center');
|
51659
|
+
activeButton.classList.remove('items-center');
|
51660
|
+
activeButton.classList.add('inline-block');
|
51655
51661
|
}
|
51656
51662
|
if (val === 'full') {
|
51657
|
-
|
51658
|
-
|
51659
|
-
|
51660
|
-
|
51663
|
+
activeButton.classList.remove('inline-block');
|
51664
|
+
activeButton.classList.add('flex');
|
51665
|
+
activeButton.classList.add('justify-center');
|
51666
|
+
activeButton.classList.add('items-center');
|
51661
51667
|
}
|
51662
51668
|
this.applyDefault(activeButton);
|
51663
51669
|
|
@@ -76826,6 +76832,7 @@ class Lib {
|
|
76826
76832
|
activeBox.classList.add('is-content-bottom');
|
76827
76833
|
activeBox.classList.add('edge-y-2');
|
76828
76834
|
}
|
76835
|
+
this.builder.hideElementTools();
|
76829
76836
|
}
|
76830
76837
|
updateContentSize(activeBox, val) {
|
76831
76838
|
const container = activeBox.querySelector('.is-container');
|
@@ -77425,6 +77432,81 @@ class Lib {
|
|
77425
77432
|
}
|
77426
77433
|
return null;
|
77427
77434
|
}
|
77435
|
+
moveBlockContent(target) {
|
77436
|
+
const cell = this.builder.activeCol;
|
77437
|
+
if (!cell) return false;
|
77438
|
+
if (!(target === 'top' || target === 'bottom' || target === 'left' || target === 'right' || target === 'topleft' || target === 'topcenter' || target === 'topright' || target === 'bottomleft' || target === 'bottomcenter' || target === 'bottomright' || target === 'center')) return;
|
77439
|
+
this.builder.saveForUndo();
|
77440
|
+
const dom = this.builder.dom;
|
77441
|
+
let classes = this.builder.cssClasses.display;
|
77442
|
+
dom.addCssClass(cell, classes.flex, classes);
|
77443
|
+
classes = this.builder.cssClasses.flexDirection;
|
77444
|
+
dom.addCssClass(cell, classes.column, classes);
|
77445
|
+
if (target === 'top') {
|
77446
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77447
|
+
dom.addCssClass(cell, classes.start, classes);
|
77448
|
+
classes = this.builder.cssClasses.alignItems;
|
77449
|
+
dom.addCssClass(cell, classes.center, classes);
|
77450
|
+
} else if (target === 'bottom') {
|
77451
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77452
|
+
dom.addCssClass(cell, classes.end, classes);
|
77453
|
+
classes = this.builder.cssClasses.alignItems;
|
77454
|
+
dom.addCssClass(cell, classes.center, classes);
|
77455
|
+
} else if (target === 'left') {
|
77456
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77457
|
+
dom.addCssClass(cell, classes.center, classes);
|
77458
|
+
classes = this.builder.cssClasses.alignItems;
|
77459
|
+
dom.addCssClass(cell, classes.start, classes);
|
77460
|
+
} else if (target === 'right') {
|
77461
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77462
|
+
dom.addCssClass(cell, classes.center, classes);
|
77463
|
+
classes = this.builder.cssClasses.alignItems;
|
77464
|
+
dom.addCssClass(cell, classes.end, classes);
|
77465
|
+
} else if (target === 'topleft') {
|
77466
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77467
|
+
dom.addCssClass(cell, classes.start, classes);
|
77468
|
+
classes = this.builder.cssClasses.alignItems;
|
77469
|
+
dom.addCssClass(cell, classes.start, classes);
|
77470
|
+
} else if (target === 'topcenter') {
|
77471
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77472
|
+
dom.addCssClass(cell, classes.start, classes);
|
77473
|
+
classes = this.builder.cssClasses.alignItems;
|
77474
|
+
dom.addCssClass(cell, classes.center, classes);
|
77475
|
+
} else if (target === 'topright') {
|
77476
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77477
|
+
dom.addCssClass(cell, classes.start, classes);
|
77478
|
+
classes = this.builder.cssClasses.alignItems;
|
77479
|
+
dom.addCssClass(cell, classes.end, classes);
|
77480
|
+
} else if (target === 'bottomleft') {
|
77481
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77482
|
+
dom.addCssClass(cell, classes.end, classes);
|
77483
|
+
classes = this.builder.cssClasses.alignItems;
|
77484
|
+
dom.addCssClass(cell, classes.start, classes);
|
77485
|
+
} else if (target === 'bottomcenter') {
|
77486
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77487
|
+
dom.addCssClass(cell, classes.end, classes);
|
77488
|
+
classes = this.builder.cssClasses.alignItems;
|
77489
|
+
dom.addCssClass(cell, classes.center, classes);
|
77490
|
+
} else if (target === 'bottomright') {
|
77491
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77492
|
+
dom.addCssClass(cell, classes.end, classes);
|
77493
|
+
classes = this.builder.cssClasses.alignItems;
|
77494
|
+
dom.addCssClass(cell, classes.end, classes);
|
77495
|
+
} else if (target === 'center') {
|
77496
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77497
|
+
dom.addCssClass(cell, classes.center, classes);
|
77498
|
+
classes = this.builder.cssClasses.alignItems;
|
77499
|
+
dom.addCssClass(cell, classes.center, classes);
|
77500
|
+
} else {
|
77501
|
+
let classes = this.builder.cssClasses.justifyContent;
|
77502
|
+
dom.addCssClass(cell, classes.center, classes);
|
77503
|
+
classes = this.builder.cssClasses.alignItems;
|
77504
|
+
dom.addCssClass(cell, classes.center, classes);
|
77505
|
+
}
|
77506
|
+
cell.style.justifyContent = '';
|
77507
|
+
cell.style.alignItems = '';
|
77508
|
+
this.builder.onChange();
|
77509
|
+
}
|
77428
77510
|
}
|
77429
77511
|
|
77430
77512
|
// import RecordRTC from 'recordrtc';
|
@@ -77447,32 +77529,56 @@ class Dictation {
|
|
77447
77529
|
}
|
77448
77530
|
|
77449
77531
|
this.builder.isInProgress = false;
|
77450
|
-
const commandInfo = this.builder.commandInfo;
|
77451
|
-
let htmlList = '';
|
77452
|
-
for (const key in commandInfo) {
|
77453
|
-
if (Object.prototype.hasOwnProperty.call(commandInfo, key)) {
|
77454
|
-
const {
|
77455
|
-
title,
|
77456
|
-
list,
|
77457
|
-
width
|
77458
|
-
} = commandInfo[key];
|
77459
|
-
if (!this.builder.enableShortCommands) {
|
77460
|
-
if (key === 'general') {
|
77461
|
-
htmlList += `<h2>${title}</h2>`;
|
77462
|
-
for (const item of list) {
|
77463
|
-
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>`;
|
77464
|
-
}
|
77465
|
-
}
|
77466
|
-
} else {
|
77467
|
-
htmlList += `<h2>${title}</h2>`;
|
77468
|
-
for (const item of list) {
|
77469
|
-
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>`;
|
77470
|
-
}
|
77471
|
-
}
|
77472
|
-
}
|
77473
|
-
}
|
77474
77532
|
let html = `
|
77475
77533
|
<style>
|
77534
|
+
#_cbhtml .is-modal.page-command {
|
77535
|
+
width: 25vw;
|
77536
|
+
min-width: 393px;
|
77537
|
+
max-width: 600px;
|
77538
|
+
height: 230px;
|
77539
|
+
top: auto;
|
77540
|
+
bottom: 30px;
|
77541
|
+
left: auto;
|
77542
|
+
right: 30px;
|
77543
|
+
z-index: 10005;
|
77544
|
+
font-size: 12px;
|
77545
|
+
border-radius: 6px;
|
77546
|
+
}
|
77547
|
+
#_cbhtml .is-modal.page-command textarea {
|
77548
|
+
border:none;border-top: rgb(133 133 133 / 14%) 1px solid;resize:none;width:100%;
|
77549
|
+
height:170px;outline:none;background:transparent;line-height: 1.2;
|
77550
|
+
font-family: sans-serif;font-weight: 300;font-size: 17px;padding-top:12px;
|
77551
|
+
}
|
77552
|
+
.page-command-overlay {
|
77553
|
+
position: fixed;
|
77554
|
+
background: rgb(148 148 148 / 22%);
|
77555
|
+
display: none;
|
77556
|
+
z-index: 10004;
|
77557
|
+
justify-content: center;
|
77558
|
+
align-items:center;
|
77559
|
+
}
|
77560
|
+
#_cbhtml .div-assistant-mode button {
|
77561
|
+
padding: 0 17px;height:26px;border-radius:20px;box-shadow:none;
|
77562
|
+
}
|
77563
|
+
#_cbhtml .div-assistant-mode button[disabled] {
|
77564
|
+
pointer-events: none;
|
77565
|
+
opacity: 0.5;
|
77566
|
+
background: transparent;
|
77567
|
+
}
|
77568
|
+
/*
|
77569
|
+
.is-modal.commandconfig,
|
77570
|
+
#_cbhtml .is-modal.commandconfig label {
|
77571
|
+
font-size: 14px;
|
77572
|
+
}
|
77573
|
+
*/
|
77574
|
+
.is-modal.commandconfig ul {
|
77575
|
+
margin: 0;
|
77576
|
+
padding: 0 0 0 16px;
|
77577
|
+
}
|
77578
|
+
.is-modal.commandconfig ul li {
|
77579
|
+
font-size: inherit;
|
77580
|
+
line-height: 1.2;
|
77581
|
+
}
|
77476
77582
|
.is-modal.commandlist {
|
77477
77583
|
z-index: 10005 !important
|
77478
77584
|
}
|
@@ -77512,9 +77618,18 @@ class Dictation {
|
|
77512
77618
|
flex: none;
|
77513
77619
|
font-family: "Open Sans", sans-serif;
|
77514
77620
|
font-weight: 300;
|
77515
|
-
margin-bottom:
|
77621
|
+
margin-bottom: 10px;
|
77516
77622
|
font-size: 28px;
|
77517
77623
|
}
|
77624
|
+
.is-modal.commandlist .is-modal-content > div > p {
|
77625
|
+
display: block;
|
77626
|
+
width: 100%;
|
77627
|
+
flex: none;
|
77628
|
+
font-family: "Open Sans", sans-serif;
|
77629
|
+
font-weight: 300;
|
77630
|
+
font-size: 17px !important;
|
77631
|
+
margin: 0 0 30px;
|
77632
|
+
}
|
77518
77633
|
.is-modal.commandlist .is-modal-content > div > div {
|
77519
77634
|
margin-right: 2.2rem;
|
77520
77635
|
margin-bottom: 2.2rem;
|
@@ -77543,24 +77658,6 @@ class Dictation {
|
|
77543
77658
|
.dark .is-modal.commandlist .is-modal-content > div > div:hover {
|
77544
77659
|
background: rgba(255, 255, 255, 0.05);
|
77545
77660
|
}
|
77546
|
-
.is-modal.page-command {
|
77547
|
-
width: 340px !important;
|
77548
|
-
height: 200px !important;
|
77549
|
-
top: auto !important;
|
77550
|
-
bottom: 30px !important;
|
77551
|
-
left: auto !important;
|
77552
|
-
right: 30px !important;
|
77553
|
-
z-index: 10005 !important;
|
77554
|
-
font-size: 12px;
|
77555
|
-
}
|
77556
|
-
.page-command-overlay {
|
77557
|
-
position: fixed;
|
77558
|
-
background: rgb(148 148 148 / 22%);
|
77559
|
-
display: none;
|
77560
|
-
z-index: 10004;
|
77561
|
-
justify-content: center;
|
77562
|
-
align-items:center;
|
77563
|
-
}
|
77564
77661
|
|
77565
77662
|
.spinner {
|
77566
77663
|
-webkit-animation: rotator 1.4s linear infinite;
|
@@ -77619,6 +77716,11 @@ class Dictation {
|
|
77619
77716
|
.inp-command::placeholder {
|
77620
77717
|
color: #aaa;
|
77621
77718
|
}
|
77719
|
+
|
77720
|
+
.label-chk-autosend-command,
|
77721
|
+
.label-input-autosend-command {
|
77722
|
+
display: none !important;
|
77723
|
+
}
|
77622
77724
|
</style>
|
77623
77725
|
<div class="is-overlay page-command-overlay">
|
77624
77726
|
<svg class="spinner" width="40px" height="40px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
@@ -77631,25 +77733,36 @@ class Dictation {
|
|
77631
77733
|
justify-content: center;
|
77632
77734
|
align-items: center;">
|
77633
77735
|
${util.out('AI Assistant')}</span>
|
77736
|
+
|
77634
77737
|
<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
|
77635
|
-
<svg class="is-icon-flex"style="width:
|
77738
|
+
<svg class="is-icon-flex"style="width:22px;height:22px"><use xlink:href="#ion-ios-close-empty"></use></svg>
|
77636
77739
|
</button>
|
77637
77740
|
</div>
|
77638
77741
|
<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;">
|
77639
|
-
|
77640
|
-
|
77641
|
-
|
77642
|
-
|
77742
|
+
<div style="display:flex;align-items:center;justify-content:center;padding: 2px 13px 10px;">
|
77743
|
+
<div class="div-assistant-mode" style="display:flex;align-items: center;">
|
77744
|
+
<button class="scope-section on" title="${util.out('General')}" data-value="general" style="margin-right:5px">${util.out('General')}</button>
|
77745
|
+
<button class="scope-others" title="${util.out('Ask Questions')}" data-value="others">${util.out('Ask Questions')}</button>
|
77746
|
+
<button class="scope-block" title="${util.out('Edit Selected Block')}" data-value="block" style="">${util.out('Edit Selected Block')}</button>
|
77747
|
+
</div>
|
77748
|
+
</div>
|
77749
|
+
<textarea class="inp-command"></textarea>
|
77750
|
+
<div style="display:flex;padding-left:3px;">
|
77751
|
+
<button title="${util.out('Settings')}" class="cmd-command-config classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
|
77752
|
+
<svg class="is-icon-flex" style="width:15px;height:15px;flex:none;"><use xlink:href="#icon-settings"></use></svg>
|
77753
|
+
</button>
|
77643
77754
|
<button title="${util.out('Mic')}" class="cmd-enable-dictation classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
|
77644
77755
|
<svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-microphone"></use></svg>
|
77645
77756
|
</button>
|
77646
|
-
<button title="${util.out('
|
77757
|
+
<button title="${util.out('Command Examples')}" class="cmd-command-list classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
|
77647
77758
|
<svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-message-search"></use></svg>
|
77648
77759
|
</button>
|
77649
|
-
<button title="${util.out('Clear')}" class="cmd-clear-command classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
|
77760
|
+
<button title="${util.out('Clear')}" class="cmd-clear-command classic-secondary" style="margin-right:6px;width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
|
77650
77761
|
<svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-eraser"></use></svg>
|
77651
77762
|
</button>
|
77652
|
-
|
77763
|
+
|
77764
|
+
<label class="label-chk-autosend-command" for="chkAutoSendCommand" style="margin:0;display:flex;padding-left:10px;padding-right:25px;white-space:nowrap;align-items:center;letter-spacing:0"><input id="chkAutoSendCommand" type="checkbox"> <span style="margin-left:3px">${util.out('Auto Send')}</span></label>
|
77765
|
+
|
77653
77766
|
<button title="${util.out('Send')}" class="cmd-send-command classic-primary" style="width:100%;padding-left:5px;padding-right:5px;height:43px;outline-offset:-2px;">Send</button>
|
77654
77767
|
</div>
|
77655
77768
|
</div>
|
@@ -77662,10 +77775,55 @@ class Dictation {
|
|
77662
77775
|
<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
|
77663
77776
|
<svg class="is-icon-flex"><use xlink:href="#ion-ios-close-empty"></use></svg>
|
77664
77777
|
</button>
|
77665
|
-
<div>
|
77778
|
+
<div class="div-command-list">
|
77666
77779
|
|
77667
|
-
|
77780
|
+
</div>
|
77781
|
+
</div>
|
77782
|
+
</div>
|
77668
77783
|
|
77784
|
+
<div class="is-modal commandconfig" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
77785
|
+
<div class="is-modal-content" style="max-width:380px;padding:55px 40px 35px;">
|
77786
|
+
<div class="is-modal-bar is-draggable">
|
77787
|
+
${util.out('Settings')}
|
77788
|
+
<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">✕</button>
|
77789
|
+
</div>
|
77790
|
+
|
77791
|
+
<div class="is-label"><span>${util.out('Temperature')}</span>: <span class="val-temp">0.6</span></div>
|
77792
|
+
<div style="padding-top:4px">
|
77793
|
+
<input type="range" min="0" max="2" step="0.01" value="0.6" class="temperature-slider is-rangeslider" style="margin:0 !important;">
|
77794
|
+
</div>
|
77795
|
+
|
77796
|
+
<div class="is-label" style="margin-top:15px"><span>${util.out('Top P')}</span>: <span class="val-top-p">0.9</span></div>
|
77797
|
+
<div style="padding-top:4px">
|
77798
|
+
<input type="range" min="0" max="1" step="0.01" value="0.9" class="top-p-slider is-rangeslider" style="margin:0 !important;">
|
77799
|
+
</div>
|
77800
|
+
|
77801
|
+
<div style="text-align:right">
|
77802
|
+
<button title="${util.out('Reset')}" class="input-reset classic-secondary" style="text-decoration: underline;padding: 0;box-shadow: none;">${util.out('Reset')}</button>
|
77803
|
+
</div>
|
77804
|
+
|
77805
|
+
<label for="chkAutoEditBlock" style="margin:0;display:flex;align-items:center;letter-spacing:0">
|
77806
|
+
<input id="chkAutoEditBlock" type="checkbox" style="margin:0 5px 0 0;">
|
77807
|
+
<span style="line-height: 1;">${util.out('Auto select \'Edit Selected Block\' mode.')}</span>
|
77808
|
+
</label>
|
77809
|
+
|
77810
|
+
<label class="label-input-autosend-command" style="margin:18px 0 0 0;display:flex;align-items:center;letter-spacing:0">
|
77811
|
+
<span>${util.out('Auto send command delay')}</soan>:
|
77812
|
+
<input class="input-autosend-delay" style="width:60px;text-align:center;padding-left:0;height:33px;margin-right:3px;" type="text" value="4000"> <span>ms</span>
|
77813
|
+
</label>
|
77814
|
+
|
77815
|
+
<div class="command-settings-info" style="display:none"></div>
|
77816
|
+
|
77817
|
+
<label class="label-input-command-lang" style="display:none;flex-direction:column;letter-spacing:0;margin:18px 0 0 0;">
|
77818
|
+
<span>${util.out('Language')}:</span>
|
77819
|
+
<div style="display:flex; align-items: baseline;flex-direction: row;">
|
77820
|
+
<input class="input-command-lang" style="width:70px;text-align:center;padding-left:0;height:33px;margin-top:5px;margin-right:10px" type="text" value="en-us">
|
77821
|
+
<span>(${util.out('BCP-47 format')})</span>
|
77822
|
+
</div>
|
77823
|
+
</label>
|
77824
|
+
|
77825
|
+
<div style="text-align:right;margin-top:25px;">
|
77826
|
+
<button title="${util.out('Ok')}" class="input-ok classic-primary" style="width:100%;">${util.out('Ok')}</button>
|
77669
77827
|
</div>
|
77670
77828
|
</div>
|
77671
77829
|
</div>
|
@@ -77675,10 +77833,47 @@ class Dictation {
|
|
77675
77833
|
this.modalCommand = modalCommand;
|
77676
77834
|
const modalCommandList = builderStuff.querySelector('.commandlist');
|
77677
77835
|
this.modalCommandList = modalCommandList;
|
77836
|
+
const modalConfig = builderStuff.querySelector('.commandconfig');
|
77837
|
+
this.modalConfig = modalConfig;
|
77838
|
+
const btnConfig = builderStuff.querySelector('.cmd-command-config');
|
77678
77839
|
const btnDictation = builderStuff.querySelector('.cmd-enable-dictation');
|
77679
77840
|
const btnClear = builderStuff.querySelector('.cmd-clear-command');
|
77680
77841
|
const chkAutoSend = builderStuff.querySelector('#chkAutoSendCommand');
|
77681
77842
|
const btnCommandList = builderStuff.querySelector('.cmd-command-list');
|
77843
|
+
const divInfo = builderStuff.querySelector('.command-settings-info');
|
77844
|
+
let info = `
|
77845
|
+
<div style="font-weight:500;margin: 25px 0 7px;">${util.out('Dictation')}</div>
|
77846
|
+
<div style="line-height: 1.4;margin: 0 0 7px;">${util.out('These words trigger command actions')}:</div>
|
77847
|
+
<ul>`;
|
77848
|
+
const triggerWords = this.builder.triggerWords;
|
77849
|
+
for (const key in triggerWords) {
|
77850
|
+
if (key === 'send') {
|
77851
|
+
let s = '';
|
77852
|
+
triggerWords[key].forEach(word => {
|
77853
|
+
s += `, ${word}`;
|
77854
|
+
});
|
77855
|
+
s = s.substring(1);
|
77856
|
+
info += `<li><span>${s}</span></li>`;
|
77857
|
+
}
|
77858
|
+
if (key === 'abort') {
|
77859
|
+
let s = '';
|
77860
|
+
triggerWords[key].forEach(word => {
|
77861
|
+
s += `, ${word}`;
|
77862
|
+
});
|
77863
|
+
s = s.substring(1);
|
77864
|
+
info += `<li><span>${s}</span></li>`;
|
77865
|
+
}
|
77866
|
+
if (key === 'clear') {
|
77867
|
+
let s = '';
|
77868
|
+
triggerWords[key].forEach(word => {
|
77869
|
+
s += `, ${word}`;
|
77870
|
+
});
|
77871
|
+
s = s.substring(1);
|
77872
|
+
info += `<li><span>${s}</span></li>`;
|
77873
|
+
}
|
77874
|
+
}
|
77875
|
+
info += '</ul>';
|
77876
|
+
divInfo.innerHTML = info;
|
77682
77877
|
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
77683
77878
|
if (localStorage.getItem('_sampleshown') === null) {
|
77684
77879
|
inpCommand.setAttribute('placeholder', this.builder.commandPlaceholderText);
|
@@ -77702,7 +77897,6 @@ class Dictation {
|
|
77702
77897
|
if (localStorage.getItem('_mic') === '0') {
|
77703
77898
|
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
77704
77899
|
chkAutoSend.parentNode.style.display = 'none';
|
77705
|
-
btnClear.style.marginRight = '6px';
|
77706
77900
|
}
|
77707
77901
|
}
|
77708
77902
|
if (localStorage.getItem('_autosendcommand') !== null) {
|
@@ -77716,48 +77910,148 @@ class Dictation {
|
|
77716
77910
|
util.saveSelection(); // must be called in case used by formatText()
|
77717
77911
|
});
|
77718
77912
|
|
77913
|
+
btnConfig.addEventListener('click', () => {
|
77914
|
+
this.config();
|
77915
|
+
|
77916
|
+
// util.showModal(this.modalConfig, false, ()=>{
|
77917
|
+
|
77918
|
+
// btnConfig.removeAttribute('data-focus');
|
77919
|
+
// btnConfig.focus();
|
77920
|
+
|
77921
|
+
// }, false);
|
77922
|
+
|
77923
|
+
// btnConfig.setAttribute('data-focus',true);
|
77924
|
+
});
|
77925
|
+
|
77926
|
+
if (localStorage.getItem('_temp') !== null) {
|
77927
|
+
let val = localStorage.getItem('_temp');
|
77928
|
+
this.builder.temperature = val;
|
77929
|
+
}
|
77930
|
+
if (localStorage.getItem('_top_p') !== null) {
|
77931
|
+
let val = localStorage.getItem('_top_p');
|
77932
|
+
this.builder.topP = val;
|
77933
|
+
}
|
77934
|
+
if (localStorage.getItem('_autosend_delay') !== null) {
|
77935
|
+
let val = localStorage.getItem('_autosend_delay');
|
77936
|
+
this.builder.autoSendDelay = val;
|
77937
|
+
}
|
77938
|
+
if (localStorage.getItem('_auto_editblock') !== null) {
|
77939
|
+
let val = localStorage.getItem('_auto_editblock');
|
77940
|
+
this.builder.autoEditBlock = val;
|
77941
|
+
}
|
77942
|
+
if (localStorage.getItem('_command_lang') !== null) {
|
77943
|
+
let val = localStorage.getItem('_command_lang');
|
77944
|
+
this.builder.speechRecognitionLang = val;
|
77945
|
+
}
|
77946
|
+
const btnConfigOk = this.modalConfig.querySelector('.input-ok');
|
77947
|
+
btnConfigOk.addEventListener('click', () => {
|
77948
|
+
const tempSlider = this.modalConfig.querySelector('.temperature-slider');
|
77949
|
+
localStorage.setItem('_temp', tempSlider.value);
|
77950
|
+
this.builder.temperature = tempSlider.value;
|
77951
|
+
const topPSlider = this.modalConfig.querySelector('.top-p-slider');
|
77952
|
+
localStorage.setItem('_top_p', topPSlider.value);
|
77953
|
+
this.builder.topP = topPSlider.value;
|
77954
|
+
const chkAutoEditBlock = this.modalConfig.querySelector('#chkAutoEditBlock');
|
77955
|
+
if (chkAutoEditBlock.checked) {
|
77956
|
+
localStorage.setItem('_auto_editblock', 1);
|
77957
|
+
this.builder.autoEditBlock = true;
|
77958
|
+
} else {
|
77959
|
+
localStorage.setItem('_auto_editblock', 0);
|
77960
|
+
this.builder.autoEditBlock = false;
|
77961
|
+
}
|
77962
|
+
const inpAutoSendDelay = this.modalConfig.querySelector('.input-autosend-delay');
|
77963
|
+
localStorage.setItem('_autosend_delay', inpAutoSendDelay.value);
|
77964
|
+
this.builder.autoSendDelay = inpAutoSendDelay.value;
|
77965
|
+
const inpCommandLang = this.modalConfig.querySelector('.input-command-lang');
|
77966
|
+
localStorage.setItem('_command_lang', inpCommandLang.value);
|
77967
|
+
this.builder.speechRecognitionLang = inpCommandLang.value;
|
77968
|
+
this.builder.hideModal(this.modalConfig);
|
77969
|
+
});
|
77970
|
+
const btnConfigReset = this.modalConfig.querySelector('.input-reset');
|
77971
|
+
btnConfigReset.addEventListener('click', () => {
|
77972
|
+
this.resetConfig();
|
77973
|
+
});
|
77974
|
+
const valTemp = this.modalConfig.querySelector('.val-temp');
|
77975
|
+
const tempSlider = this.modalConfig.querySelector('.temperature-slider');
|
77976
|
+
tempSlider.oninput = () => {
|
77977
|
+
valTemp.innerHTML = tempSlider.value;
|
77978
|
+
};
|
77979
|
+
const valTopP = this.modalConfig.querySelector('.val-top-p');
|
77980
|
+
const topPSlider = this.modalConfig.querySelector('.top-p-slider');
|
77981
|
+
topPSlider.oninput = () => {
|
77982
|
+
valTopP.innerHTML = topPSlider.value;
|
77983
|
+
};
|
77719
77984
|
btnCommandList.addEventListener('click', () => {
|
77985
|
+
let htmlList = '';
|
77986
|
+
const commandInfo = this.builder.commandInfo;
|
77987
|
+
for (const key in commandInfo) {
|
77988
|
+
if (Object.prototype.hasOwnProperty.call(commandInfo, key)) {
|
77989
|
+
const {
|
77990
|
+
title,
|
77991
|
+
description,
|
77992
|
+
list,
|
77993
|
+
width
|
77994
|
+
} = commandInfo[key];
|
77995
|
+
if (!this.builder.enableShortCommands) {
|
77996
|
+
if (description) {
|
77997
|
+
htmlList += `<h2>${title}</h2>`;
|
77998
|
+
htmlList += `<p>${description}</p>`;
|
77999
|
+
} else {
|
78000
|
+
htmlList += `<h2 style="margin-bottom:30px">${title}</h2>`;
|
78001
|
+
}
|
78002
|
+
for (const item of list) {
|
78003
|
+
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>`;
|
78004
|
+
}
|
78005
|
+
} else {
|
78006
|
+
htmlList += `<h2>${title}</h2>`;
|
78007
|
+
for (const item of list) {
|
78008
|
+
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>`;
|
78009
|
+
}
|
78010
|
+
}
|
78011
|
+
}
|
78012
|
+
}
|
78013
|
+
const divCommandList = this.modalCommandList.querySelector('.div-command-list');
|
78014
|
+
divCommandList.innerHTML = htmlList;
|
78015
|
+
const handleSelect = s => {
|
78016
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
78017
|
+
inpCommand.value = s;
|
78018
|
+
this.builder.commandText = inpCommand.value;
|
78019
|
+
util.hideModal(this.modalCommandList);
|
78020
|
+
};
|
78021
|
+
let items = this.modalCommandList.querySelectorAll('.command-item');
|
78022
|
+
items.forEach(elm => {
|
78023
|
+
elm.addEventListener('click', () => {
|
78024
|
+
handleSelect(elm.innerText);
|
78025
|
+
inpCommand.focus();
|
78026
|
+
});
|
78027
|
+
elm.addEventListener('keydown', e => {
|
78028
|
+
if (e.which === 13 && !e.shiftKey) {
|
78029
|
+
e.preventDefault();
|
78030
|
+
e.stopImmediatePropagation();
|
78031
|
+
handleSelect(elm.innerText);
|
78032
|
+
setTimeout(() => {
|
78033
|
+
inpCommand.focus();
|
78034
|
+
}, 300);
|
78035
|
+
}
|
78036
|
+
});
|
78037
|
+
});
|
77720
78038
|
util.showModal(this.modalCommandList, false, () => {
|
77721
78039
|
btnCommandList.removeAttribute('data-focus');
|
77722
78040
|
btnCommandList.focus();
|
77723
78041
|
}, false);
|
77724
78042
|
btnCommandList.setAttribute('data-focus', true);
|
77725
78043
|
});
|
77726
|
-
const handleSelect = s => {
|
77727
|
-
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
77728
|
-
inpCommand.value = s;
|
77729
|
-
util.hideModal(this.modalCommandList);
|
77730
|
-
};
|
77731
|
-
let items = modalCommandList.querySelectorAll('.command-item');
|
77732
|
-
items.forEach(elm => {
|
77733
|
-
elm.addEventListener('click', () => {
|
77734
|
-
handleSelect(elm.innerText);
|
77735
|
-
inpCommand.focus();
|
77736
|
-
});
|
77737
|
-
elm.addEventListener('keydown', e => {
|
77738
|
-
if (e.which === 13 && !e.shiftKey) {
|
77739
|
-
e.preventDefault();
|
77740
|
-
e.stopImmediatePropagation();
|
77741
|
-
handleSelect(elm.innerText);
|
77742
|
-
setTimeout(() => {
|
77743
|
-
inpCommand.focus();
|
77744
|
-
}, 300);
|
77745
|
-
}
|
77746
|
-
});
|
77747
|
-
});
|
77748
78044
|
btnDictation.addEventListener('click', () => {
|
77749
78045
|
if (!this.checkMic()) {
|
77750
78046
|
this.startDictation();
|
77751
78047
|
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone"></use></svg>';
|
77752
78048
|
localStorage.setItem('_mic', '1');
|
77753
78049
|
chkAutoSend.parentNode.style.display = 'flex';
|
77754
|
-
btnClear.style.marginRight = '';
|
77755
78050
|
} else {
|
77756
78051
|
this.stopDictation();
|
77757
78052
|
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
77758
78053
|
localStorage.setItem('_mic', '0');
|
77759
78054
|
chkAutoSend.parentNode.style.display = 'none';
|
77760
|
-
btnClear.style.marginRight = '6px';
|
77761
78055
|
}
|
77762
78056
|
});
|
77763
78057
|
chkAutoSend.addEventListener('change', () => {
|
@@ -77781,6 +78075,8 @@ class Dictation {
|
|
77781
78075
|
// Abort
|
77782
78076
|
|
77783
78077
|
this.opts.abort();
|
78078
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
78079
|
+
this.builder.commandText = inpCommand.value;
|
77784
78080
|
return;
|
77785
78081
|
}
|
77786
78082
|
const inpCommand = this.modalCommand.querySelector('.inp-command');
|
@@ -77792,6 +78088,8 @@ class Dictation {
|
|
77792
78088
|
|
77793
78089
|
// this.startSending();
|
77794
78090
|
|
78091
|
+
// Clear
|
78092
|
+
this.builder.commandText = '';
|
77795
78093
|
this.opts.send(question);
|
77796
78094
|
});
|
77797
78095
|
inpCommand.addEventListener('keydown', e => {
|
@@ -77814,9 +78112,123 @@ class Dictation {
|
|
77814
78112
|
this.stopDictation();
|
77815
78113
|
localStorage.setItem('_dictation', '0');
|
77816
78114
|
});
|
78115
|
+
const btnScopeSection = this.modalCommand.querySelector('.scope-section');
|
78116
|
+
const btnScopeBlock = this.modalCommand.querySelector('.scope-block');
|
78117
|
+
const btnScopeOthers = this.modalCommand.querySelector('.scope-others');
|
78118
|
+
btnScopeBlock.disabled = true;
|
78119
|
+
const assistModeBtns = modalCommand.querySelectorAll('.div-assistant-mode button');
|
78120
|
+
assistModeBtns.forEach(btn => {
|
78121
|
+
btn.addEventListener('click', () => {
|
78122
|
+
assistModeBtns.forEach(item => {
|
78123
|
+
item.classList.remove('on');
|
78124
|
+
});
|
78125
|
+
btn.classList.add('on');
|
78126
|
+
const val = btn.getAttribute('data-value');
|
78127
|
+
this.builder.assistantMode = val; // general, block, others
|
78128
|
+
|
78129
|
+
/*
|
78130
|
+
// ContentBox
|
78131
|
+
if(val==='general') {
|
78132
|
+
if(!this.builder.activeCol) return;
|
78133
|
+
const box = this.builder.activeCol.closest('.is-box');
|
78134
|
+
const section = this.builder.activeCol.closest('.is-section');
|
78135
|
+
const wrapper = this.builder.activeCol.closest('.is-wrapper');
|
78136
|
+
if(!(box && section && wrapper)) return;
|
78137
|
+
|
78138
|
+
box.click();
|
78139
|
+
|
78140
|
+
if(!wrapper.classList.contains('hard-select')) box.click();
|
78141
|
+
}
|
78142
|
+
*/
|
78143
|
+
});
|
78144
|
+
});
|
78145
|
+
|
78146
|
+
//Extend onSelectionChange
|
78147
|
+
let old = this.builder.settings.onSelectionChange;
|
78148
|
+
this.builder.settings.onSelectionChange = () => {
|
78149
|
+
if (old) old.call(this); // call user's defined onRender
|
78150
|
+
|
78151
|
+
if (this.builder.activeCol) {
|
78152
|
+
if (this.builder.autoEditBlock) {
|
78153
|
+
// change
|
78154
|
+
this.builder.assistantMode = 'block';
|
78155
|
+
btnScopeBlock.classList.add('on');
|
78156
|
+
btnScopeSection.classList.remove('on');
|
78157
|
+
btnScopeOthers.classList.remove('on');
|
78158
|
+
}
|
78159
|
+
btnScopeBlock.removeAttribute('disabled');
|
78160
|
+
} else {
|
78161
|
+
btnScopeBlock.disabled = true;
|
78162
|
+
if (btnScopeOthers.classList.contains('on')) return;
|
78163
|
+
|
78164
|
+
// change
|
78165
|
+
this.builder.assistantMode = 'general';
|
78166
|
+
btnScopeSection.classList.add('on');
|
78167
|
+
btnScopeBlock.classList.remove('on');
|
78168
|
+
btnScopeOthers.classList.remove('on');
|
78169
|
+
}
|
78170
|
+
};
|
77817
78171
|
this.initialStart = false; // for Safari
|
77818
78172
|
}
|
77819
78173
|
|
78174
|
+
resetConfig() {
|
78175
|
+
const tempSlider = this.modalConfig.querySelector('.temperature-slider');
|
78176
|
+
const valTemp = this.modalConfig.querySelector('.val-temp');
|
78177
|
+
tempSlider.value = this.builder.temperature;
|
78178
|
+
valTemp.innerHTML = this.builder.temperature;
|
78179
|
+
const topPSlider = this.modalConfig.querySelector('.top-p-slider');
|
78180
|
+
const valTopP = this.modalConfig.querySelector('.val-top-p');
|
78181
|
+
topPSlider.value = this.builder.topP;
|
78182
|
+
valTopP.innerHTML = this.builder.topP;
|
78183
|
+
}
|
78184
|
+
config() {
|
78185
|
+
this.builder.showModal(this.modalConfig, false);
|
78186
|
+
const tempSlider = this.modalConfig.querySelector('.temperature-slider');
|
78187
|
+
const valTemp = this.modalConfig.querySelector('.val-temp');
|
78188
|
+
if (localStorage.getItem('_temp') !== null) {
|
78189
|
+
let val = localStorage.getItem('_temp');
|
78190
|
+
tempSlider.value = val;
|
78191
|
+
valTemp.innerHTML = val;
|
78192
|
+
} else {
|
78193
|
+
tempSlider.value = this.builder.temperature;
|
78194
|
+
valTemp.innerHTML = this.builder.temperature;
|
78195
|
+
}
|
78196
|
+
const topPSlider = this.modalConfig.querySelector('.top-p-slider');
|
78197
|
+
const valTopP = this.modalConfig.querySelector('.val-top-p');
|
78198
|
+
if (localStorage.getItem('_top_p') !== null) {
|
78199
|
+
let val = localStorage.getItem('_top_p');
|
78200
|
+
topPSlider.value = val;
|
78201
|
+
valTopP.innerHTML = val;
|
78202
|
+
} else {
|
78203
|
+
topPSlider.value = this.builder.topP;
|
78204
|
+
valTopP.innerHTML = this.builder.topP;
|
78205
|
+
}
|
78206
|
+
const chkAutoEditBlock = this.modalConfig.querySelector('#chkAutoEditBlock');
|
78207
|
+
if (localStorage.getItem('_auto_editblock') !== null) {
|
78208
|
+
let val = localStorage.getItem('_auto_editblock');
|
78209
|
+
if (val === '1') {
|
78210
|
+
chkAutoEditBlock.checked = true;
|
78211
|
+
} else {
|
78212
|
+
chkAutoEditBlock.checked = false;
|
78213
|
+
}
|
78214
|
+
} else {
|
78215
|
+
chkAutoEditBlock.checked = this.builder.autoEditBlock;
|
78216
|
+
}
|
78217
|
+
const inpAutoSendDelay = this.modalConfig.querySelector('.input-autosend-delay');
|
78218
|
+
if (localStorage.getItem('_autosend_delay') !== null) {
|
78219
|
+
let val = localStorage.getItem('_autosend_delay');
|
78220
|
+
inpAutoSendDelay.value = val;
|
78221
|
+
} else {
|
78222
|
+
inpAutoSendDelay.value = this.builder.autoSendDelay;
|
78223
|
+
}
|
78224
|
+
const inpCommandLang = this.modalConfig.querySelector('.input-command-lang');
|
78225
|
+
if (localStorage.getItem('_command_lang') !== null) {
|
78226
|
+
let val = localStorage.getItem('_command_lang');
|
78227
|
+
inpCommandLang.value = val;
|
78228
|
+
} else {
|
78229
|
+
inpCommandLang.value = this.builder.speechRecognitionLang;
|
78230
|
+
}
|
78231
|
+
}
|
77820
78232
|
checkMic() {
|
77821
78233
|
if (localStorage.getItem('_mic') !== null) {
|
77822
78234
|
if (localStorage.getItem('_mic') === '0') {
|
@@ -77841,16 +78253,13 @@ class Dictation {
|
|
77841
78253
|
inpCommand.focus();
|
77842
78254
|
localStorage.setItem('_dictation', '1');
|
77843
78255
|
const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
|
77844
|
-
const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
|
77845
78256
|
if (this.checkMic()) {
|
77846
78257
|
// Do Nothing
|
77847
78258
|
chkAutoSend.parentNode.style.display = 'flex';
|
77848
|
-
btnClear.style.marginRight = '';
|
77849
78259
|
} else {
|
77850
78260
|
const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
|
77851
78261
|
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
77852
78262
|
chkAutoSend.parentNode.style.display = 'none';
|
77853
|
-
btnClear.style.marginRight = '6px';
|
77854
78263
|
return;
|
77855
78264
|
}
|
77856
78265
|
this.startDictation();
|
@@ -77886,13 +78295,11 @@ class Dictation {
|
|
77886
78295
|
if (this.builder.onlineDemo) {
|
77887
78296
|
setTimeout(() => {
|
77888
78297
|
const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
|
77889
|
-
const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
|
77890
78298
|
const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
|
77891
78299
|
this.stopDictation();
|
77892
78300
|
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
77893
78301
|
localStorage.setItem('_mic', '0');
|
77894
78302
|
chkAutoSend.parentNode.style.display = 'none';
|
77895
|
-
btnClear.style.marginRight = '6px';
|
77896
78303
|
}, 1); // to give delay from the btnDictation click
|
77897
78304
|
|
77898
78305
|
//Show info
|
@@ -77910,13 +78317,11 @@ class Dictation {
|
|
77910
78317
|
} catch (e) {
|
77911
78318
|
setTimeout(() => {
|
77912
78319
|
const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
|
77913
|
-
const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
|
77914
78320
|
const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
|
77915
78321
|
this.stopDictation();
|
77916
78322
|
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
77917
78323
|
localStorage.setItem('_mic', '0');
|
77918
78324
|
chkAutoSend.parentNode.style.display = 'none';
|
77919
|
-
btnClear.style.marginRight = '6px';
|
77920
78325
|
}, 1); // to give delay from the btnDictation click
|
77921
78326
|
|
77922
78327
|
//Show info
|
@@ -77937,10 +78342,6 @@ class Dictation {
|
|
77937
78342
|
this.mediaRecorder = new MediaRecorder(stream);
|
77938
78343
|
this.mediaRecorder.addEventListener('dataavailable', event => {
|
77939
78344
|
if (this.aborted) return;
|
77940
|
-
|
77941
|
-
// console.log(event.data);
|
77942
|
-
// if (event.data.size > 0) {
|
77943
|
-
// }
|
77944
78345
|
this.websocket.send(event.data);
|
77945
78346
|
});
|
77946
78347
|
|
@@ -77992,6 +78393,7 @@ class Dictation {
|
|
77992
78393
|
this.startDictation();
|
77993
78394
|
}, 2000);
|
77994
78395
|
}
|
78396
|
+
this.builder.commandText = '';
|
77995
78397
|
let finalTranscripts = '';
|
77996
78398
|
let speechTimeout;
|
77997
78399
|
this.websocket.onmessage = event => {
|
@@ -78005,28 +78407,74 @@ class Dictation {
|
|
78005
78407
|
this.recorder.start(); // Using Recorder
|
78006
78408
|
} */
|
78007
78409
|
|
78008
|
-
// console.log('Start Dictation');
|
78009
78410
|
this.aborted = false;
|
78010
78411
|
}
|
78011
78412
|
if (message.event === 'transcript-result') {
|
78413
|
+
const transcript = message.data.channel.alternatives[0].transcript;
|
78414
|
+
|
78415
|
+
// Actions
|
78416
|
+
const triggerWords = this.builder.triggerWords;
|
78417
|
+
const findMatchingTrigger = transcript => {
|
78418
|
+
transcript = transcript.toLowerCase();
|
78419
|
+
transcript = transcript.replace('.', '');
|
78420
|
+
for (const key in triggerWords) {
|
78421
|
+
if (triggerWords[key].some(word => transcript.includes(word))) {
|
78422
|
+
return key;
|
78423
|
+
}
|
78424
|
+
let result;
|
78425
|
+
triggerWords[key].forEach(word => {
|
78426
|
+
const similarity = this.builder.similarity.checkSimilarity(transcript, word);
|
78427
|
+
if (similarity > 0.5) {
|
78428
|
+
result = key;
|
78429
|
+
return;
|
78430
|
+
}
|
78431
|
+
});
|
78432
|
+
if (result) return result;
|
78433
|
+
}
|
78434
|
+
return null; // No match found
|
78435
|
+
};
|
78436
|
+
|
78437
|
+
if (transcript && message.data.is_final) {
|
78438
|
+
const matchingKey = findMatchingTrigger(transcript);
|
78439
|
+
if (matchingKey) {
|
78440
|
+
if (matchingKey === 'send') {
|
78441
|
+
if (inpCommand.value.trim() === '') return;
|
78442
|
+
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
78443
|
+
btnSend.click();
|
78444
|
+
return;
|
78445
|
+
} else if (matchingKey === 'abort') {
|
78446
|
+
if (this.builder.isInProgress) {
|
78447
|
+
// Abort
|
78448
|
+
this.opts.abort();
|
78449
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
78450
|
+
this.builder.commandText = inpCommand.value;
|
78451
|
+
}
|
78452
|
+
return;
|
78453
|
+
} else if (matchingKey === 'clear') {
|
78454
|
+
this.builder.commandText = '';
|
78455
|
+
inpCommand.value = '';
|
78456
|
+
return;
|
78457
|
+
}
|
78458
|
+
}
|
78459
|
+
}
|
78012
78460
|
if (this.builder.isInProgress || this.aborted) {
|
78013
78461
|
return;
|
78014
78462
|
}
|
78015
|
-
|
78463
|
+
finalTranscripts = this.builder.commandText;
|
78016
78464
|
if (transcript && message.data.is_final) {
|
78017
|
-
finalTranscripts += ' ' + transcript;
|
78465
|
+
finalTranscripts += ' ' + transcript.trim();
|
78018
78466
|
}
|
78019
78467
|
|
78020
78468
|
// Format
|
78021
78469
|
finalTranscripts = finalTranscripts.charAt(0).toUpperCase() + finalTranscripts.slice(1);
|
78022
78470
|
finalTranscripts = finalTranscripts.trim();
|
78023
|
-
|
78471
|
+
this.builder.commandText = finalTranscripts;
|
78472
|
+
if (transcript && message.data.is_final) {
|
78473
|
+
this.builder.commandText = finalTranscripts;
|
78474
|
+
inpCommand.value = finalTranscripts;
|
78475
|
+
}
|
78024
78476
|
clearTimeout(speechTimeout);
|
78025
|
-
console.log('Writing..');
|
78026
78477
|
speechTimeout = setTimeout(() => {
|
78027
|
-
console.log('Clear');
|
78028
|
-
this.builder.commandText = '';
|
78029
|
-
finalTranscripts = '';
|
78030
78478
|
if (this.builder.autoSendCommand) {
|
78031
78479
|
if (inpCommand.value.trim() === '') return;
|
78032
78480
|
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
@@ -78046,30 +78494,71 @@ class Dictation {
|
|
78046
78494
|
this.recognition.start();
|
78047
78495
|
this.speechTimeout;
|
78048
78496
|
this.builder.commandText = '';
|
78497
|
+
let finalTranscripts = '';
|
78049
78498
|
this.recognition.onresult = event => {
|
78050
|
-
|
78051
|
-
return;
|
78052
|
-
}
|
78053
|
-
let interimTranscripts = '';
|
78054
|
-
let finalTranscripts = '';
|
78499
|
+
let transcript = '';
|
78055
78500
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
78056
78501
|
if (event.results[i].isFinal) {
|
78057
|
-
|
78058
|
-
} else {
|
78059
|
-
interimTranscripts += event.results[i][0].transcript;
|
78502
|
+
transcript = event.results[i][0].transcript;
|
78060
78503
|
}
|
78061
78504
|
}
|
78062
|
-
if (
|
78063
|
-
|
78064
|
-
|
78505
|
+
if (!transcript) return;
|
78506
|
+
|
78507
|
+
// Actions
|
78508
|
+
const triggerWords = this.builder.triggerWords;
|
78509
|
+
const findMatchingTrigger = transcript => {
|
78510
|
+
transcript = transcript.toLowerCase();
|
78511
|
+
for (const key in triggerWords) {
|
78512
|
+
if (triggerWords[key].some(word => transcript.includes(word))) {
|
78513
|
+
return key;
|
78514
|
+
}
|
78515
|
+
let result;
|
78516
|
+
triggerWords[key].forEach(word => {
|
78517
|
+
const similarity = this.builder.similarity.checkSimilarity(transcript, word);
|
78518
|
+
if (similarity > 0.5) {
|
78519
|
+
result = key;
|
78520
|
+
return;
|
78521
|
+
}
|
78522
|
+
});
|
78523
|
+
if (result) return result;
|
78524
|
+
}
|
78525
|
+
return null; // No match found
|
78526
|
+
};
|
78527
|
+
|
78528
|
+
const matchingKey = findMatchingTrigger(transcript);
|
78529
|
+
if (matchingKey) {
|
78530
|
+
if (matchingKey === 'send') {
|
78531
|
+
if (inpCommand.value.trim() === '') return;
|
78532
|
+
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
78533
|
+
btnSend.click();
|
78534
|
+
return;
|
78535
|
+
} else if (matchingKey === 'abort') {
|
78536
|
+
if (this.builder.isInProgress) {
|
78537
|
+
// Abort
|
78538
|
+
this.opts.abort();
|
78539
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
78540
|
+
this.builder.commandText = inpCommand.value;
|
78541
|
+
}
|
78542
|
+
return;
|
78543
|
+
} else if (matchingKey === 'clear') {
|
78544
|
+
this.builder.commandText = '';
|
78545
|
+
inpCommand.value = '';
|
78546
|
+
return;
|
78547
|
+
}
|
78548
|
+
}
|
78549
|
+
if (this.builder.isInProgress) {
|
78065
78550
|
return;
|
78066
78551
|
}
|
78067
|
-
this.builder.commandText
|
78552
|
+
finalTranscripts = this.builder.commandText;
|
78553
|
+
finalTranscripts += ' ' + transcript.trim();
|
78068
78554
|
|
78069
|
-
|
78555
|
+
// Format
|
78556
|
+
finalTranscripts = finalTranscripts.trim();
|
78557
|
+
finalTranscripts = finalTranscripts.charAt(0).toUpperCase() + finalTranscripts.slice(1);
|
78558
|
+
this.builder.commandText = finalTranscripts;
|
78559
|
+
inpCommand.value = finalTranscripts;
|
78070
78560
|
clearTimeout(this.speechTimeout);
|
78071
78561
|
this.speechTimeout = setTimeout(() => {
|
78072
|
-
this.builder.commandText = '';
|
78073
78562
|
if (this.builder.autoSendCommand) {
|
78074
78563
|
if (inpCommand.value.trim() === '') return;
|
78075
78564
|
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
@@ -78090,13 +78579,11 @@ class Dictation {
|
|
78090
78579
|
// See btnDictation click
|
78091
78580
|
setTimeout(() => {
|
78092
78581
|
const btnDictation = this.builderStuff.querySelector('.cmd-enable-dictation');
|
78093
|
-
const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
|
78094
78582
|
const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
|
78095
78583
|
this.stopDictation();
|
78096
78584
|
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
78097
78585
|
localStorage.setItem('_mic', '0');
|
78098
78586
|
chkAutoSend.parentNode.style.display = 'none';
|
78099
|
-
btnClear.style.marginRight = '6px';
|
78100
78587
|
}, 1); // to give delay from the btnDictation click
|
78101
78588
|
|
78102
78589
|
//Show info
|
@@ -78174,6 +78661,12 @@ class Similarity {
|
|
78174
78661
|
constructor(builder) {
|
78175
78662
|
this.builder = builder;
|
78176
78663
|
}
|
78664
|
+
checkSimilarity(word1, word2) {
|
78665
|
+
word1 = word1.toLowerCase();
|
78666
|
+
word2 = word2.toLowerCase();
|
78667
|
+
const similarity = stringSimilarity.stringSimilarity(word1, word2);
|
78668
|
+
return similarity;
|
78669
|
+
}
|
78177
78670
|
check(command) {
|
78178
78671
|
const {
|
78179
78672
|
commandList
|
@@ -78830,9 +79323,20 @@ class ContentBuilder {
|
|
78830
79323
|
// speechTranscribeUrl: 'http://192.168.1.7:8081',
|
78831
79324
|
onlineDemo: false,
|
78832
79325
|
autoSendDelay: 4000,
|
79326
|
+
autoEditBlock: false,
|
78833
79327
|
commandPlaceholderText: '',
|
78834
79328
|
enableShortCommands: true,
|
78835
79329
|
speechRecognitionLang: 'en-US',
|
79330
|
+
assistantMode: 'general',
|
79331
|
+
triggerWords: {
|
79332
|
+
send: ['send', 'okay', 'ok', 'execute', 'run'],
|
79333
|
+
abort: ['abort', 'cancel'],
|
79334
|
+
clear: ['clear', 'erase']
|
79335
|
+
},
|
79336
|
+
temperature: 0.6,
|
79337
|
+
//0.4,
|
79338
|
+
topP: 0.9,
|
79339
|
+
//0.6,
|
78836
79340
|
useMediaRecorder: true,
|
78837
79341
|
// do not change
|
78838
79342
|
encoderPath: '',
|
@@ -79440,6 +79944,7 @@ class ContentBuilder {
|
|
79440
79944
|
if (this.toolbarDisplay !== 'auto') {
|
79441
79945
|
this.rte.showDefaultToolbar();
|
79442
79946
|
}
|
79947
|
+
if (this.settings.onSelectionChange) this.settings.onSelectionChange(e);
|
79443
79948
|
}
|
79444
79949
|
}
|
79445
79950
|
this.element.hyperlink.buttonEditor.hide();
|
@@ -81484,6 +81989,7 @@ class ContentBuilder {
|
|
81484
81989
|
this.resize.enable();
|
81485
81990
|
}
|
81486
81991
|
}
|
81992
|
+
if (this.settings.onSelectionChange) this.settings.onSelectionChange(e);
|
81487
81993
|
}
|
81488
81994
|
handleCellKeypress(e) {
|
81489
81995
|
if (e.ctrlKey || e.metaKey) {
|
@@ -82546,6 +83052,19 @@ class ContentBuilder {
|
|
82546
83052
|
});
|
82547
83053
|
}
|
82548
83054
|
}
|
83055
|
+
hideElementTools() {
|
83056
|
+
let elmTool = document.querySelector('.is-element-tool');
|
83057
|
+
let divImageTool = document.querySelector('#divImageTool');
|
83058
|
+
let divImageResizer = document.querySelector('#divImageResizer');
|
83059
|
+
if (divImageTool) if (divImageTool.style.display === 'flex') {
|
83060
|
+
if (this.editor.moveable) this.editor.moveable.updateRect();
|
83061
|
+
let controlBox = this.doc.querySelector('.moveable-control-box');
|
83062
|
+
if (controlBox) controlBox.style.display = 'none';
|
83063
|
+
}
|
83064
|
+
if (elmTool) elmTool.style.display = '';
|
83065
|
+
if (divImageTool) divImageTool.style.display = '';
|
83066
|
+
if (divImageResizer) divImageResizer.style.display = '';
|
83067
|
+
}
|
82549
83068
|
}
|
82550
83069
|
|
82551
83070
|
// (function(window){
|