@innovastudio/contentbuilder 1.5.132 → 1.5.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts
CHANGED
@@ -285,7 +285,11 @@ declare class ContentBuilder {
|
|
285
285
|
constructor(options?: ContentBuilderOptions);
|
286
286
|
|
287
287
|
html(element?: HTMLElement): void;
|
288
|
-
loadSnippets(snippetFile: string, snippetOpen?: boolean): void;
|
288
|
+
// loadSnippets(snippetFile: string, snippetOpen?: boolean): void;
|
289
|
+
|
290
|
+
loadSnippets(path: string, snippetOpen?: boolean): Promise<void>;
|
291
|
+
loadSnippets(source: { snippets: string; style?: string }, snippetOpen?: boolean): Promise<void>;
|
292
|
+
|
289
293
|
viewSnippets(): void;
|
290
294
|
saveImages(handler?: string, onComplete?: () => void, onBase64Upload?: () => void): void;
|
291
295
|
applyBehavior(): void;
|
package/package.json
CHANGED
@@ -83424,6 +83424,9 @@ class Dictation {
|
|
83424
83424
|
font-size: 14px;
|
83425
83425
|
}
|
83426
83426
|
*/
|
83427
|
+
.is-modal.commandconfig .is-modal-overlay {
|
83428
|
+
background: transparent !important;
|
83429
|
+
}
|
83427
83430
|
.is-modal.commandconfig ul {
|
83428
83431
|
margin: 0;
|
83429
83432
|
padding: 0 0 0 16px;
|
@@ -83600,7 +83603,7 @@ class Dictation {
|
|
83600
83603
|
align-items: center;">
|
83601
83604
|
${util.out('AI Assistant')}</span>
|
83602
83605
|
|
83603
|
-
<button class="is-modal-close"
|
83606
|
+
<button class="is-modal-close" title="${util.out('Close')}">
|
83604
83607
|
<svg class="is-icon-flex"style="width:22px;height:22px"><use xlink:href="#ion-ios-close-empty"></use></svg>
|
83605
83608
|
</button>
|
83606
83609
|
</div>
|
@@ -83648,13 +83651,20 @@ class Dictation {
|
|
83648
83651
|
</div>
|
83649
83652
|
</div>
|
83650
83653
|
|
83651
|
-
<div class="is-modal commandconfig" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
83652
|
-
<div class="is-modal-
|
83653
|
-
<
|
83654
|
-
|
83655
|
-
|
83656
|
-
|
83657
|
-
|
83654
|
+
<div class="is-modal is-modal-content commandconfig" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true" style="top:calc(50% - 250px);left:calc(50% - 191px);max-width:380px;height:auto;z-index: 10005">
|
83655
|
+
<div class="is-modal-bar is-draggable" draggable="">
|
83656
|
+
<span style="display: flex;
|
83657
|
+
justify-content: center;
|
83658
|
+
align-items: center;">
|
83659
|
+
${util.out('Settings')}</span>
|
83660
|
+
|
83661
|
+
<button class="is-modal-close" title="${util.out('Close')}">
|
83662
|
+
<svg class="is-icon-flex"style="width:22px;height:22px"><use xlink:href="#ion-ios-close-empty"></use></svg>
|
83663
|
+
</button>
|
83664
|
+
</div>
|
83665
|
+
|
83666
|
+
<div style="width:100%;border-top:transparent 35px solid;box-sizing:border-box;padding:16px 40px 35px;">
|
83667
|
+
|
83658
83668
|
<div class="is-label"><span>${util.out('Temperature')}</span>: <span class="val-temp">0.6</span></div>
|
83659
83669
|
<div style="padding-top:4px">
|
83660
83670
|
<input type="range" min="0" max="2" step="0.01" value="0.6" class="temperature-slider is-rangeslider" style="margin:0 !important;">
|
@@ -83717,6 +83727,9 @@ class Dictation {
|
|
83717
83727
|
new Draggable$2({
|
83718
83728
|
selector: '.is-modal.page-command .is-draggable'
|
83719
83729
|
});
|
83730
|
+
new Draggable$2({
|
83731
|
+
selector: '.is-modal.commandconfig .is-draggable'
|
83732
|
+
});
|
83720
83733
|
const modalCommandList = builderStuff.querySelector('.commandlist');
|
83721
83734
|
this.modalCommandList = modalCommandList;
|
83722
83735
|
const modalConfig = builderStuff.querySelector('.commandconfig');
|
@@ -97816,7 +97829,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
97816
97829
|
viewZoom() {
|
97817
97830
|
this.rte.viewZoom();
|
97818
97831
|
}
|
97819
|
-
loadSnippets(
|
97832
|
+
async loadSnippets(source, snippetOpen) {
|
97820
97833
|
if (this.preview) return;
|
97821
97834
|
if (this.opts.snippetList === '#divSnippetList') {
|
97822
97835
|
let snippetPanel = document.querySelector(this.opts.snippetList);
|
@@ -97826,31 +97839,78 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
97826
97839
|
}
|
97827
97840
|
}
|
97828
97841
|
|
97829
|
-
|
97830
|
-
|
97831
|
-
|
97832
|
-
|
97833
|
-
|
97834
|
-
|
97835
|
-
if (!
|
97836
|
-
|
97837
|
-
|
97838
|
-
|
97839
|
-
|
97840
|
-
|
97842
|
+
let snippetFile;
|
97843
|
+
if (typeof source === 'string') {
|
97844
|
+
snippetFile = source;
|
97845
|
+
} else {
|
97846
|
+
snippetFile = source.snippets;
|
97847
|
+
let linkStyle = document.head.querySelector('#_snippet_style');
|
97848
|
+
if (!linkStyle) {
|
97849
|
+
const link = document.createElement('link');
|
97850
|
+
link.id = '_snippet_style';
|
97851
|
+
link.rel = 'stylesheet';
|
97852
|
+
link.href = source.style;
|
97853
|
+
|
97854
|
+
// Find the last stylesheet <link> in <head>
|
97855
|
+
const lastCss = [...document.head.querySelectorAll('link[rel="stylesheet"]')].pop();
|
97856
|
+
if (lastCss) {
|
97857
|
+
lastCss.after(link);
|
97858
|
+
} else {
|
97859
|
+
// No linked CSS → look for first embedded <style>
|
97860
|
+
const firstStyle = document.head.querySelector('style');
|
97861
|
+
if (firstStyle) {
|
97862
|
+
document.head.insertBefore(link, firstStyle);
|
97863
|
+
} else {
|
97864
|
+
document.head.appendChild(link);
|
97865
|
+
}
|
97841
97866
|
}
|
97842
|
-
}
|
97843
97867
|
|
97844
|
-
|
97845
|
-
|
97846
|
-
|
97847
|
-
|
97848
|
-
|
97849
|
-
renderSnippetPanel(this, snippetOpen); // Render Snippet Panel
|
97868
|
+
// Then wait for it to load
|
97869
|
+
await new Promise((resolve, reject) => {
|
97870
|
+
link.onload = resolve;
|
97871
|
+
link.onerror = reject;
|
97872
|
+
});
|
97850
97873
|
}
|
97851
|
-
}
|
97874
|
+
}
|
97875
|
+
let includeScript = document.body.querySelector('#_snippet_data');
|
97876
|
+
if (!includeScript) {
|
97877
|
+
const script = document.createElement('script');
|
97878
|
+
script.src = snippetFile;
|
97879
|
+
script.id = '_snippet_data';
|
97880
|
+
script.async = true;
|
97881
|
+
script.onload = () => {
|
97882
|
+
if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
|
97883
|
+
|
97884
|
+
this.opts.snippetJSON = window.data_basic;
|
97885
|
+
if (!this.canvas) for (let i = this.opts.snippetJSON.snippets.length - 1; i >= 0; i--) {
|
97886
|
+
if (this.opts.snippetJSON.snippets[i].mode === 'canvas') {
|
97887
|
+
this.opts.snippetJSON.snippets.splice(i, 1);
|
97888
|
+
}
|
97889
|
+
}
|
97890
|
+
|
97891
|
+
// if snippetPath is specified (not empty), then use the specified. Otherwise, use the one generated from snippet file (_snippets_path)
|
97892
|
+
if (this.opts.snippetPath === '') {
|
97893
|
+
this.opts.snippetPath = window._snippets_path;
|
97894
|
+
}
|
97895
|
+
if (this.opts.snippetJSON.snippets.length > 0) {
|
97896
|
+
renderSnippetPanel(this, snippetOpen); // Render Snippet Panel
|
97897
|
+
}
|
97852
97898
|
|
97853
|
-
|
97899
|
+
if (this.opts.snippetJSON.target === 'ContentBuilder') {
|
97900
|
+
console.log(`
|
97901
|
+
ContentBuilder is a commercial library.
|
97902
|
+
Please obtain a license at: https://innovastudio.com/contentbuilder
|
97903
|
+
`);
|
97904
|
+
}
|
97905
|
+
if (this.opts.snippetJSON.target === 'ContentBox') {
|
97906
|
+
console.log(`
|
97907
|
+
ContentBox is a commercial library.
|
97908
|
+
Please obtain a license at: https://innovastudio.com/contentbox
|
97909
|
+
`);
|
97910
|
+
}
|
97911
|
+
};
|
97912
|
+
document.body.appendChild(script);
|
97913
|
+
}
|
97854
97914
|
}
|
97855
97915
|
isScriptAlreadyIncluded(src) {
|
97856
97916
|
const scripts = document.getElementsByTagName('script');
|