@innovastudio/contentbuilder 1.5.211 → 1.5.213
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 +232 -3
- package/package.json +9 -10
- package/public/contentbuilder/contentbuilder.css +11169 -6865
- package/public/contentbuilder/contentbuilder.esm.js +42164 -50757
- package/public/contentbuilder/contentbuilder.min.js +10 -107
- package/public/contentbuilder/lang/en.js +237 -6
- package/public/contentbuilder/lang/fr.js +245 -14
- package/public/contentbuilder/themes/colored-blue.css +57 -1324
- package/public/contentbuilder/themes/colored-blue2.css +57 -1324
- package/public/contentbuilder/themes/colored-blue3.css +57 -1324
- package/public/contentbuilder/themes/colored-blue4.css +57 -1324
- package/public/contentbuilder/themes/colored-blue5.css +57 -1324
- package/public/contentbuilder/themes/colored-blue6.css +57 -1324
- package/public/contentbuilder/themes/colored-blue7.css +57 -1324
- package/public/contentbuilder/themes/colored-blue8.css +57 -1324
- package/public/contentbuilder/themes/colored-cyan.css +58 -0
- package/public/contentbuilder/themes/colored-dark.css +57 -1295
- package/public/contentbuilder/themes/colored-darkblue.css +57 -1324
- package/public/contentbuilder/themes/colored-gray.css +57 -1324
- package/public/contentbuilder/themes/colored-green.css +57 -1324
- package/public/contentbuilder/themes/colored-green2.css +57 -1324
- package/public/contentbuilder/themes/colored-green3.css +57 -1324
- package/public/contentbuilder/themes/colored-green4.css +57 -1324
- package/public/contentbuilder/themes/colored-green5.css +57 -1324
- package/public/contentbuilder/themes/colored-magenta.css +57 -1324
- package/public/contentbuilder/themes/colored-orange.css +57 -1324
- package/public/contentbuilder/themes/colored-orange2.css +57 -1324
- package/public/contentbuilder/themes/colored-orange3.css +57 -1324
- package/public/contentbuilder/themes/colored-pink.css +57 -1324
- package/public/contentbuilder/themes/colored-pink2.css +57 -1324
- package/public/contentbuilder/themes/colored-pink3.css +57 -1324
- package/public/contentbuilder/themes/colored-pink4.css +57 -1324
- package/public/contentbuilder/themes/colored-purple.css +57 -1324
- package/public/contentbuilder/themes/colored-purple2.css +57 -1324
- package/public/contentbuilder/themes/colored-red.css +57 -1324
- package/public/contentbuilder/themes/colored-red2.css +57 -1324
- package/public/contentbuilder/themes/colored-red3.css +57 -1324
- package/public/contentbuilder/themes/colored-red4.css +57 -1324
- package/public/contentbuilder/themes/colored-red5.css +57 -1324
- package/public/contentbuilder/themes/colored-yellow.css +57 -1324
- package/public/contentbuilder/themes/colored-yellow2.css +57 -1324
- package/public/contentbuilder/themes/colored-yellow3.css +58 -0
- package/public/contentbuilder/themes/dark-blue.css +26 -1371
- package/public/contentbuilder/themes/dark-blue2.css +26 -1371
- package/public/contentbuilder/themes/dark-blue3.css +26 -1371
- package/public/contentbuilder/themes/dark-gray.css +26 -1371
- package/public/contentbuilder/themes/dark-pink.css +26 -1371
- package/public/contentbuilder/themes/dark-purple.css +26 -1371
- package/public/contentbuilder/themes/dark-red.css +26 -1371
- package/public/contentbuilder/themes/light-blue.css +29 -1323
- package/public/contentbuilder/themes/light-blue2.css +29 -1323
- package/public/contentbuilder/themes/light-blue3.css +29 -1323
- package/public/contentbuilder/themes/light-cyan.css +29 -1323
- package/public/contentbuilder/themes/light-gray.css +29 -1323
- package/public/contentbuilder/themes/light-gray2.css +29 -1323
- package/public/contentbuilder/themes/light-gray3.css +29 -1323
- package/public/contentbuilder/themes/light-green.css +29 -1323
- package/public/contentbuilder/themes/light-pink.css +29 -1323
- package/public/contentbuilder/themes/light-pink2.css +29 -1323
- package/public/contentbuilder/themes/light-purple.css +29 -1323
- package/public/contentbuilder/themes/light-purple2.css +29 -1323
- package/public/contentbuilder/themes/light-red.css +29 -1323
- package/public/contentbuilder/themes/light-yellow.css +29 -1323
- package/public/contentbuilder/themes/light-yellow2.css +29 -1323
- package/readme.txt +225 -154
- package/public/contentbuilder/config.js +0 -7
- package/public/contentbuilder/content.css +0 -7777
- package/public/contentbuilder/plugins/animation/plugin.js +0 -25
- package/public/contentbuilder/plugins/buttoneditor/images/a.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/b.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/c.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/d.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/e.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/f.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/g.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/images/h.jpg +0 -0
- package/public/contentbuilder/plugins/buttoneditor/plugin.js +0 -1600
- package/public/contentbuilder/plugins/buttoneditor/readme.txt +0 -7
- package/public/contentbuilder/plugins/helloworld/plugin.js +0 -21
- package/public/contentbuilder/plugins/helloworld/readme.txt +0 -23
- package/public/contentbuilder/plugins/preview/plugin.js +0 -371
- package/public/contentbuilder/plugins/preview/readme.txt +0 -23
- package/public/contentbuilder/plugins/searchreplace/plugin.js +0 -524
- package/public/contentbuilder/plugins/searchreplace/readme.txt +0 -23
- package/public/contentbuilder/plugins/searchreplace/searchreplace.html +0 -264
- package/public/contentbuilder/plugins/showgrid/plugin.js +0 -74
- package/public/contentbuilder/plugins/showgrid/readme.txt +0 -23
- package/public/contentbuilder/plugins/symbols/plugin.js +0 -3126
- package/public/contentbuilder/plugins/symbols/readme.txt +0 -23
- package/public/contentbuilder/plugins/wordcount/plugin.js +0 -76
- package/public/contentbuilder/plugins/wordcount/readme.txt +0 -23
- package/public/contentbuilder/themes/dark.css +0 -1377
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Hello World Plugin
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
(function () {
|
|
6
|
-
if(typeof _cb === 'undefined') return;
|
|
7
|
-
|
|
8
|
-
var button_html = '<button id="my_helloworld_button" title="Hello World" style="text-transform:none">hello</button>';
|
|
9
|
-
|
|
10
|
-
_cb.addButton('helloworld', button_html, '#my_helloworld_button', function () {
|
|
11
|
-
|
|
12
|
-
alert('Hello World');
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
_cb.addButton2('helloworld', button_html, '#my_helloworld_button', function () {
|
|
16
|
-
|
|
17
|
-
alert('Hello World');
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
})();
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Hello World Plugin
|
|
2
|
-
|
|
3
|
-
To install the plugin, modify config file (contentbuilder\config.js) as follow:
|
|
4
|
-
|
|
5
|
-
_cb.settings.plugins = ['helloworld'];
|
|
6
|
-
|
|
7
|
-
This plugin will add a 'Hello World' button on the 'More' popup on toolbar (click the 'More' button).
|
|
8
|
-
|
|
9
|
-
You can also add the "helloworld" button on the buttons or buttonsMore parameters:
|
|
10
|
-
|
|
11
|
-
var obj = $.contentbuilder({
|
|
12
|
-
...
|
|
13
|
-
buttons: [..., "helloworld", ...]
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
or
|
|
17
|
-
|
|
18
|
-
var obj = $.contentbuilder({
|
|
19
|
-
...
|
|
20
|
-
buttonsMore: [..., "helloworld", ...]
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
For more info about buttons or buttonsMore parameters, please check the ContentBuilder.js readme.txt.
|
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Preview Plugin
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
(function () {
|
|
6
|
-
if(typeof _cb === 'undefined') return;
|
|
7
|
-
|
|
8
|
-
var _screenwidth = window.innerWidth;
|
|
9
|
-
if (_screenwidth <= 640) return;
|
|
10
|
-
|
|
11
|
-
var html =
|
|
12
|
-
'<div class="is-modal is-modal-content previewcontent" style="z-index:10004;" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">' +
|
|
13
|
-
'<div style="width:100%;height:100%;position: relative;display: flex;flex-direction: column;align-items: center;padding: 0px;">' +
|
|
14
|
-
'<div class="is-modal-close" style="z-index:2;width:30px;height:30px;position:absolute;top:0px;right:0px;box-sizing:border-box;padding:0;line-height:30px;font-size: 12px;color:#777;text-align:center;cursor:pointer;"><svg class="is-icon-flex" style="width:30px;height:30px;"><use xlink:href="#ion-ios-close-empty"></use></svg></div>' +
|
|
15
|
-
'<div class="is-modal-bar" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;line-height:1.5;height:32px;padding:0;">' +
|
|
16
|
-
'<div style="width:100%;height:100%;display:flex;justify-content:center;">' +
|
|
17
|
-
'<div class="size-control" data-width="1440" style="width:1440px;border-left: none; border-right: none;">' +
|
|
18
|
-
'<div class="size-control" data-width="1024" style="width:1024px;">' +
|
|
19
|
-
'<div class="size-control" data-width="768" style="width:768px;">' +
|
|
20
|
-
'<div class="size-control" data-width="425" style="width:425px;">' +
|
|
21
|
-
'<div class="size-control" data-width="375" style="width:375px;">' +
|
|
22
|
-
'<div class="size-control" data-width="320" style="width:320px;">' +
|
|
23
|
-
'<div class="size-control-info" style="line-height:32px;">1440px</div>' +
|
|
24
|
-
"</div>" +
|
|
25
|
-
"</div>" +
|
|
26
|
-
"</div>" +
|
|
27
|
-
"</div>" +
|
|
28
|
-
"</div>" +
|
|
29
|
-
"</div>" +
|
|
30
|
-
"</div>" +
|
|
31
|
-
"</div>" +
|
|
32
|
-
'<iframe tabindex="0" data-width="1440" style="width:100%;height:100%;max-width:1440px;border:none;border-top:32px solid transparent;margin:0;box-sizing:border-box;background:#fff;" src="about:blank"></iframe>' +
|
|
33
|
-
"</div>" +
|
|
34
|
-
"</div>";
|
|
35
|
-
|
|
36
|
-
_cb.addHtml(html);
|
|
37
|
-
|
|
38
|
-
// var css =
|
|
39
|
-
// "<style>" +
|
|
40
|
-
// ".size-control {cursor:pointer;background:#ddd;border-left:#fff 2px solid;border-right:#fff 2px solid;height:100%;display:flex;justify-content:center;}" +
|
|
41
|
-
// ".size-control-info {text-align:center;color:#000;}" +
|
|
42
|
-
// ".size-control.hover {background:rgb(170,170,170);}" +
|
|
43
|
-
// "</style>";
|
|
44
|
-
|
|
45
|
-
// _cb.addCss(css);
|
|
46
|
-
|
|
47
|
-
var button_html =
|
|
48
|
-
'<button class="previewcontent-button" title="' + _cb.out('Preview') + '" style="font-size:15px;vertical-align:bottom;">' +
|
|
49
|
-
'<svg class="is-icon-flex"><use xlink:href="#ion-eye"></use></svg>' +
|
|
50
|
-
"</button>";
|
|
51
|
-
|
|
52
|
-
_cb.addButton('preview', button_html, '.previewcontent-button', function (e) {
|
|
53
|
-
|
|
54
|
-
showPreviewWindow();
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
_cb.addButton2('preview', button_html, '.previewcontent-button', function (e) {
|
|
59
|
-
|
|
60
|
-
showPreviewWindow();
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
var modal = document.querySelector(".is-modal.previewcontent");
|
|
66
|
-
if(!modal) return; // in case builder is destroyed
|
|
67
|
-
|
|
68
|
-
var btnClose = modal.querySelector('.is-modal-close');
|
|
69
|
-
btnClose.addEventListener('click', function(e){
|
|
70
|
-
_cb.hideModal(modal);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
var removeClass = function(element, classname) {
|
|
74
|
-
if(!element) return;
|
|
75
|
-
if(element.classList.length>0) {
|
|
76
|
-
element.className = element.className.replace(new RegExp('\\b'+ classname+'\\b', 'g'), '');
|
|
77
|
-
element.className = element.className.replace(/ +/g, ' ');
|
|
78
|
-
if(element.className === ' ') element.removeAttribute('class');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var addClass = function(element, classname) {
|
|
83
|
-
if(!element) return;
|
|
84
|
-
if(hasClass(element,classname)) return;
|
|
85
|
-
if(element.classList.length===0) element.className = classname;
|
|
86
|
-
else element.className = element.className + ' ' + classname;
|
|
87
|
-
element.className = element.className.replace(/ +/g, ' ');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var hasClass = function(element, classname) {
|
|
91
|
-
if(!element) return false;
|
|
92
|
-
try{
|
|
93
|
-
let s = element.getAttribute('class');
|
|
94
|
-
return new RegExp('\\b'+ classname+'\\b').test(s);
|
|
95
|
-
} catch(e) {
|
|
96
|
-
0;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var sizeControls = modal.querySelectorAll(".size-control");
|
|
101
|
-
Array.prototype.forEach.call(sizeControls, function(sizeControl){
|
|
102
|
-
|
|
103
|
-
sizeControl.addEventListener('mouseover', function(e) {
|
|
104
|
-
|
|
105
|
-
var elms = modal.querySelectorAll(".size-control");
|
|
106
|
-
Array.prototype.forEach.call(elms, function(elm){
|
|
107
|
-
// elm.style.background = "#ddd";
|
|
108
|
-
removeClass(elm, 'hover');
|
|
109
|
-
});
|
|
110
|
-
// sizeControl.style.background = "#aaa";
|
|
111
|
-
addClass(sizeControl, 'hover');
|
|
112
|
-
|
|
113
|
-
elms = sizeControl.querySelectorAll(".size-control");
|
|
114
|
-
Array.prototype.forEach.call(elms, function(elm){
|
|
115
|
-
// elm.style.background = "#aaa";
|
|
116
|
-
addClass(elm, 'hover');
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// modal.querySelector(".size-control-info").style.color = '#fff';
|
|
120
|
-
|
|
121
|
-
var w = sizeControl.getAttribute('data-width');
|
|
122
|
-
modal.querySelector(".size-control-info").innerHTML = w + 'px';
|
|
123
|
-
e.preventDefault();
|
|
124
|
-
e.stopImmediatePropagation();
|
|
125
|
-
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
sizeControl.addEventListener('mouseout', function(e) {
|
|
129
|
-
|
|
130
|
-
var elms = modal.querySelectorAll(".size-control");
|
|
131
|
-
Array.prototype.forEach.call(elms, function(elm){
|
|
132
|
-
// elm.style.background = "#ddd";
|
|
133
|
-
removeClass(elm, 'hover');
|
|
134
|
-
});
|
|
135
|
-
// modal.querySelector(".size-control-info").style.color = '#000';
|
|
136
|
-
|
|
137
|
-
var currW = modal.querySelector("iframe").getAttribute('data-width');
|
|
138
|
-
modal.querySelector(".size-control-info").innerText = currW + 'px';
|
|
139
|
-
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
sizeControl.addEventListener('click', function(e) {
|
|
143
|
-
|
|
144
|
-
var w = sizeControl.getAttribute('data-width');
|
|
145
|
-
|
|
146
|
-
modal.querySelector("iframe").style.maxWidth = w + 'px';
|
|
147
|
-
modal.querySelector("iframe").setAttribute('data-width', w);
|
|
148
|
-
|
|
149
|
-
e.preventDefault();
|
|
150
|
-
e.stopImmediatePropagation();
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
})();
|
|
157
|
-
|
|
158
|
-
function showPreviewWindow() {
|
|
159
|
-
|
|
160
|
-
var modal = document.querySelector(".is-modal.previewcontent");
|
|
161
|
-
_cb.showModal(modal);
|
|
162
|
-
|
|
163
|
-
if (!this._cb.doc.querySelector(".is-wrapper") && _cb.previewURL) {
|
|
164
|
-
var html = _cb.html();
|
|
165
|
-
localStorage.setItem('preview-html', html);
|
|
166
|
-
|
|
167
|
-
modal.querySelector('iframe').src = _cb.previewURL;
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
//check if builder is inside iframe
|
|
172
|
-
if(window.frameElement) {
|
|
173
|
-
var c = getFramedWindow(window.frameElement);
|
|
174
|
-
var doc = c.document;
|
|
175
|
-
} else {
|
|
176
|
-
var doc = parent.document;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
var basehref = "";
|
|
180
|
-
var base = doc.querySelectorAll("base[href]");
|
|
181
|
-
if (base.length > 0) {
|
|
182
|
-
basehref = '<base href="' + base[0].href + '" />';
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
var csslinks = "";
|
|
186
|
-
var styles = doc.querySelectorAll("link[href]");
|
|
187
|
-
for (var i = 0; i < styles.length; i++) {
|
|
188
|
-
if (
|
|
189
|
-
styles[i].href.indexOf(".css") != -1 &&
|
|
190
|
-
styles[i].href.indexOf("contentbox.css") == -1 &&
|
|
191
|
-
styles[i].href.indexOf("contentbuilder.css") == -1
|
|
192
|
-
) {
|
|
193
|
-
csslinks +=
|
|
194
|
-
'<link href="' +
|
|
195
|
-
styles[i].href +
|
|
196
|
-
'" rel="stylesheet" type="text/css" />';
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
var jsincludes1 = "";
|
|
201
|
-
var scripts = doc.head.querySelectorAll("script[src]");
|
|
202
|
-
for (var i = 0; i < scripts.length; i++) {
|
|
203
|
-
if (
|
|
204
|
-
scripts[i].src.indexOf(".js") != -1 &&
|
|
205
|
-
scripts[i].src.indexOf("_next/") == -1 && //next
|
|
206
|
-
scripts[i].src.indexOf("static/js/") == -1 && //react
|
|
207
|
-
scripts[i].src.indexOf("src/") == -1 && //vue
|
|
208
|
-
scripts[i].src.indexOf("index") == -1 &&
|
|
209
|
-
scripts[i].src.indexOf("contentbox.js") == -1 &&
|
|
210
|
-
scripts[i].src.indexOf("contentbox.min.js") == -1 &&
|
|
211
|
-
scripts[i].src.indexOf("contentbuilder.js") == -1 &&
|
|
212
|
-
scripts[i].src.indexOf("contentbuilder.min.js") == -1 &&
|
|
213
|
-
scripts[i].src.indexOf("plugin.js") == -1 &&
|
|
214
|
-
scripts[i].src.indexOf("config.js") == -1 &&
|
|
215
|
-
scripts[i].src.indexOf("en.js") == -1 &&
|
|
216
|
-
scripts[i].src.indexOf("rangy") == -1 &&
|
|
217
|
-
scripts[i].src.indexOf("minimalist-blocks") == -1
|
|
218
|
-
) {
|
|
219
|
-
jsincludes1 +=
|
|
220
|
-
'<script src="' +
|
|
221
|
-
scripts[i].src +
|
|
222
|
-
'" type="text/javascript"></script>';
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
var jsincludes2 = "";
|
|
227
|
-
var scripts = doc.body.querySelectorAll("script[src]");
|
|
228
|
-
for (var i = 0; i < scripts.length; i++) {
|
|
229
|
-
// console.log(scripts[i].src)
|
|
230
|
-
if (
|
|
231
|
-
scripts[i].src.indexOf(".js") != -1 &&
|
|
232
|
-
scripts[i].src.indexOf("_next/") == -1 && //next
|
|
233
|
-
scripts[i].src.indexOf("static/js/") == -1 && //react
|
|
234
|
-
scripts[i].src.indexOf("src/") == -1 && //vue
|
|
235
|
-
scripts[i].src.indexOf("index") == -1 &&
|
|
236
|
-
scripts[i].src.indexOf("contentbox.js") == -1 &&
|
|
237
|
-
scripts[i].src.indexOf("contentbox.min.js") == -1 &&
|
|
238
|
-
scripts[i].src.indexOf("contentbuilder.js") == -1 &&
|
|
239
|
-
scripts[i].src.indexOf("contentbuilder.min.js") == -1 &&
|
|
240
|
-
scripts[i].src.indexOf("plugin.js") == -1 &&
|
|
241
|
-
scripts[i].src.indexOf("config.js") == -1 &&
|
|
242
|
-
scripts[i].src.indexOf("en.js") == -1 &&
|
|
243
|
-
scripts[i].src.indexOf("rangy") == -1 &&
|
|
244
|
-
scripts[i].src.indexOf("minimalist-blocks") == -1
|
|
245
|
-
) {
|
|
246
|
-
jsincludes2 +=
|
|
247
|
-
'<script src="' +
|
|
248
|
-
scripts[i].src +
|
|
249
|
-
'" type="text/javascript"></script>';
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
var escHtml = `
|
|
254
|
-
<script>
|
|
255
|
-
document.addEventListener('keydown', (e)=>{
|
|
256
|
-
if(e.keyCode === 27) { // escape key
|
|
257
|
-
|
|
258
|
-
var modal = parent.document.querySelector(".is-modal.previewcontent");
|
|
259
|
-
parent._cb.hideModal(modal);
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
</script>`;
|
|
263
|
-
|
|
264
|
-
/* Get Page */
|
|
265
|
-
if (!this._cb.doc.querySelector(".is-wrapper")) {
|
|
266
|
-
var maxwidth = "800px";
|
|
267
|
-
var maxw = window.getComputedStyle(this._cb.doc.querySelector(".is-builder")).getPropertyValue('max-width');
|
|
268
|
-
if (!isNaN(parseInt(maxw))) maxwidth = maxw;
|
|
269
|
-
|
|
270
|
-
var content = _cb.html();
|
|
271
|
-
|
|
272
|
-
var doc = modal.querySelector('iframe').contentWindow.document;
|
|
273
|
-
doc.open();
|
|
274
|
-
doc.write(
|
|
275
|
-
"<html>" +
|
|
276
|
-
"<head>" +
|
|
277
|
-
basehref +
|
|
278
|
-
'<meta charset="utf-8">' +
|
|
279
|
-
"<title></title>" +
|
|
280
|
-
"<style>#_cbhtml > *:not(.is-lightbox) {display:none}</style>" +
|
|
281
|
-
csslinks +
|
|
282
|
-
(_cb.useLightbox? '<link href="'+_cb.assetPath+'scripts/lightbox/lightbox.css" rel="stylesheet" type="text/css" />':'') +
|
|
283
|
-
"<style>" +
|
|
284
|
-
".slider-image { display:block !important; }" +
|
|
285
|
-
".container {margin:35px auto 0; max-width: " +
|
|
286
|
-
maxwidth +
|
|
287
|
-
"; width:100%; padding:0 20px; box-sizing: border-box;}" +
|
|
288
|
-
"</style>" +
|
|
289
|
-
'<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>' +
|
|
290
|
-
jsincludes1 +
|
|
291
|
-
"</head>" +
|
|
292
|
-
"<body>" +
|
|
293
|
-
'<div class="container preview">' +
|
|
294
|
-
content +
|
|
295
|
-
"</div>" +
|
|
296
|
-
jsincludes2 +
|
|
297
|
-
(_cb.useLightbox? '<script src="'+_cb.assetPath+'scripts/lightbox/lightbox.js"></script><script>window.lightbox.init();</script>':'') +
|
|
298
|
-
escHtml +
|
|
299
|
-
"</body>" +
|
|
300
|
-
"</html>"
|
|
301
|
-
);
|
|
302
|
-
doc.close();
|
|
303
|
-
|
|
304
|
-
} else {
|
|
305
|
-
// ContentBox
|
|
306
|
-
var content = parent.contentbox.html();
|
|
307
|
-
|
|
308
|
-
if(parent.contentbox.previewPage) {
|
|
309
|
-
let html = parent.contentbox.html();
|
|
310
|
-
localStorage.setItem('preview-html', html);
|
|
311
|
-
let mainCss = parent.contentbox.mainCss();
|
|
312
|
-
localStorage.setItem('preview-maincss', mainCss);
|
|
313
|
-
let sectionCss = parent.contentbox.sectionCss();
|
|
314
|
-
localStorage.setItem('preview-sectioncss', sectionCss);
|
|
315
|
-
modal.querySelector('iframe').src = parent.contentbox.previewPage; //'/preview.html';
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// var doc = modal.querySelector('iframe').contentWindow.document;
|
|
320
|
-
// doc.open();
|
|
321
|
-
// doc.write(
|
|
322
|
-
// "<html>" +
|
|
323
|
-
// "<head>" +
|
|
324
|
-
// basehref +
|
|
325
|
-
// '<meta charset="utf-8">' +
|
|
326
|
-
// "<title></title>" +
|
|
327
|
-
// csslinks +
|
|
328
|
-
// (_cb.useLightbox? '<link href="'+_cb.assetPath+'scripts/lightbox/lightbox.css" rel="stylesheet" type="text/css" />':'') +
|
|
329
|
-
// "<style>" +
|
|
330
|
-
// ".slider-image { display:block !important; }" +
|
|
331
|
-
// "#_cbhtml > *:not(.is-lightbox) {display:none}" +
|
|
332
|
-
// "</style>" +
|
|
333
|
-
// '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>' +
|
|
334
|
-
// jsincludes1 +
|
|
335
|
-
// "</head>" +
|
|
336
|
-
// "<body>" +
|
|
337
|
-
// '<div class="is-wrapper preview">' +
|
|
338
|
-
// content +
|
|
339
|
-
// "</div>" +
|
|
340
|
-
// jsincludes2 +
|
|
341
|
-
// escHtml +
|
|
342
|
-
// "</body>" +
|
|
343
|
-
// "</html>"
|
|
344
|
-
// );
|
|
345
|
-
// doc.close();
|
|
346
|
-
|
|
347
|
-
let html = parent.contentbox.html();
|
|
348
|
-
localStorage.setItem('preview-html', html);
|
|
349
|
-
let mainCss = parent.contentbox.mainCss();
|
|
350
|
-
localStorage.setItem('preview-maincss', mainCss);
|
|
351
|
-
let sectionCss = parent.contentbox.sectionCss();
|
|
352
|
-
localStorage.setItem('preview-sectioncss', sectionCss);
|
|
353
|
-
|
|
354
|
-
if(parent.contentbox.previewURL) {
|
|
355
|
-
modal.querySelector('iframe').src = parent.contentbox.previewURL;
|
|
356
|
-
} else {
|
|
357
|
-
modal.querySelector('iframe').src = 'preview.html';
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
//Or you can specify your custom preview page:
|
|
361
|
-
//modal.find('iframe').attr('src','preview.html');
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
function getFramedWindow(f) {
|
|
365
|
-
if(f.parentNode == null)
|
|
366
|
-
f = document.body.appendChild(f);
|
|
367
|
-
var w = (f.contentWindow || f.contentDocument);
|
|
368
|
-
if(w && w.nodeType && w.nodeType==9)
|
|
369
|
-
w = (w.defaultView || w.parentWindow);
|
|
370
|
-
return w;
|
|
371
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Preview Plugin
|
|
2
|
-
|
|
3
|
-
To install the plugin, modify config file (contentbuilder\config.js) as follow:
|
|
4
|
-
|
|
5
|
-
_cb.settings.plugins = ['preview'];
|
|
6
|
-
|
|
7
|
-
This plugin will add a 'Preview' button on the 'More' popup on the toolbar (click the 'More' button).
|
|
8
|
-
|
|
9
|
-
You can also add the "preview" button on the toolbar as follow:
|
|
10
|
-
|
|
11
|
-
var obj = $.contentbuilder({
|
|
12
|
-
...
|
|
13
|
-
buttons: [..., "preview", ...]
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
or
|
|
17
|
-
|
|
18
|
-
var obj = $.contentbuilder({
|
|
19
|
-
...
|
|
20
|
-
buttonsMore: [..., "preview", ...]
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
(For more info about buttons or buttonsMore parameters, please check the ContentBuilder.js readme.txt)
|