Skip to content

Commit fe1d3cc

Browse files
committed
Editor sec fix, toolbar reponsiveness tracking fix, responsive
contextmenu. v4.9.10
1 parent 8213c82 commit fe1d3cc

8 files changed

+159
-30
lines changed

Diff for: dist/jsuites.basic.css

+34
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,40 @@
840840
pointer-events: auto;
841841
}
842842

843+
@media only screen and (max-width: 420px) {
844+
.jcontextmenu {
845+
top: initial !important;
846+
left: 0px !important;
847+
bottom: 0px !important;
848+
width: 100vw;
849+
height: 260px;
850+
overflow: scroll;
851+
animation: slide-bottom-in 0.4s forwards;
852+
}
853+
.jcontextmenu div {
854+
width: 100%;
855+
text-align: center;
856+
border-bottom: 1px solid #ccc;
857+
padding: 15px;
858+
}
859+
.jcontextmenu > div::before {
860+
display: none;
861+
}
862+
.jcontextmenu a {
863+
font-size: 1.4em;
864+
text-transform: uppercase;
865+
}
866+
.jcontextmenu span {
867+
display: none;
868+
}
869+
.jcontextmenu span {
870+
display: none;
871+
}
872+
.jcontextmenu hr {
873+
display: none;
874+
}
875+
}
876+
843877
.jdropdown {
844878
cursor:pointer;
845879
-webkit-touch-callout: none;

Diff for: dist/jsuites.basic.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
var jSuites = function(options) {
1919
var obj = {}
20-
var version = '4.9.9';
20+
var version = '4.4.0';
2121

2222
var find = function(DOMElement, component) {
2323
if (DOMElement[component.type] && DOMElement[component.type] == component) {
@@ -5271,7 +5271,7 @@ jSuites.editor = (function(el, options) {
52715271
}
52725272

52735273
// Elements to be removed
5274-
var remove = [HTMLUnknownElement];
5274+
var remove = [HTMLUnknownElement,HTMLAudioElement,HTMLEmbedElement,HTMLIFrameElement,HTMLTextAreaElement,HTMLInputElement,HTMLScriptElement];
52755275

52765276
// Valid CSS attributes
52775277
var validStyle = ['color', 'font-weight', 'font-size', 'background', 'background-color', 'margin'];
@@ -5296,9 +5296,9 @@ jSuites.editor = (function(el, options) {
52965296
}
52975297
}
52985298
// Process image
5299-
if (element.tagName == 'IMG') {
5299+
if (element.tagName.toUpperCase() == 'IMG') {
53005300
if (! obj.options.acceptImages) {
5301-
element.remove();
5301+
element.parentNode.removeChild(element);
53025302
} else {
53035303
// Check if is data
53045304
element.setAttribute('tabindex', '900');
@@ -5334,9 +5334,11 @@ jSuites.editor = (function(el, options) {
53345334
if (data) {
53355335
data = data.replace(new RegExp('<!--(.*?)-->', 'gsi'), '');
53365336
}
5337+
var parser = new DOMParser();
5338+
var d = parser.parseFromString(data, "text/html");
5339+
parse(d);
53375340
var span = document.createElement('span');
5338-
span.innerHTML = data;
5339-
parse(span);
5341+
span.innerHTML = d.firstChild.innerHTML;
53405342
return span;
53415343
}
53425344

@@ -9114,7 +9116,8 @@ jSuites.tabs = (function(el, options) {
91149116
});
91159117

91169118
jSuites.toolbar = (function(el, options) {
9117-
var obj = {};
9119+
// New instance
9120+
var obj = { type:'toolbar' };
91189121
obj.options = {};
91199122

91209123
// Default configuration
@@ -9124,6 +9127,7 @@ jSuites.toolbar = (function(el, options) {
91249127
badge: false,
91259128
title: false,
91269129
responsive: false,
9130+
maxWidth: null,
91279131
items: [],
91289132
}
91299133

@@ -9322,16 +9326,21 @@ jSuites.toolbar = (function(el, options) {
93229326

93239327
obj.refresh = function() {
93249328
if (obj.options.responsive == true) {
9329+
// Width of the c
9330+
var rect = el.parentNode.getBoundingClientRect();
9331+
if (! obj.options.maxWidth) {
9332+
obj.options.maxWidth = rect.width;
9333+
}
9334+
// Max width
9335+
var width = parseInt(obj.options.maxWidth);
93259336
// Remove arrow
93269337
toolbarArrow.remove();
93279338
// Move all items to the toolbar
93289339
while (toolbarFloating.firstChild) {
93299340
toolbarContent.appendChild(toolbarFloating.firstChild);
93309341
}
9331-
// Width of the c
9332-
var rect = el.parentNode.getBoundingClientRect();
93339342
// Available parent space
9334-
var available = rect.width;
9343+
var available = obj.options.maxWidth;
93359344
// Toolbar is larger than the parent, move elements to the floating element
93369345
if (available < toolbarContent.offsetWidth) {
93379346
// Give space to the floating element

Diff for: dist/jsuites.css

+34
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,40 @@
840840
pointer-events: auto;
841841
}
842842

843+
@media only screen and (max-width: 420px) {
844+
.jcontextmenu {
845+
top: initial !important;
846+
left: 0px !important;
847+
bottom: 0px !important;
848+
width: 100vw;
849+
height: 260px;
850+
overflow: scroll;
851+
animation: slide-bottom-in 0.4s forwards;
852+
}
853+
.jcontextmenu div {
854+
width: 100%;
855+
text-align: center;
856+
border-bottom: 1px solid #ccc;
857+
padding: 15px;
858+
}
859+
.jcontextmenu > div::before {
860+
display: none;
861+
}
862+
.jcontextmenu a {
863+
font-size: 1.4em;
864+
text-transform: uppercase;
865+
}
866+
.jcontextmenu span {
867+
display: none;
868+
}
869+
.jcontextmenu span {
870+
display: none;
871+
}
872+
.jcontextmenu hr {
873+
display: none;
874+
}
875+
}
876+
843877
.jdropdown {
844878
cursor:pointer;
845879
-webkit-touch-callout: none;

Diff for: dist/jsuites.js

+19-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
var jSuites = function(options) {
1919
var obj = {}
20-
var version = '4.9.9';
20+
var version = '4.4.0';
2121

2222
var find = function(DOMElement, component) {
2323
if (DOMElement[component.type] && DOMElement[component.type] == component) {
@@ -5282,7 +5282,7 @@ jSuites.editor = (function(el, options) {
52825282
}
52835283

52845284
// Elements to be removed
5285-
var remove = [HTMLUnknownElement];
5285+
var remove = [HTMLUnknownElement,HTMLAudioElement,HTMLEmbedElement,HTMLIFrameElement,HTMLTextAreaElement,HTMLInputElement,HTMLScriptElement];
52865286

52875287
// Valid CSS attributes
52885288
var validStyle = ['color', 'font-weight', 'font-size', 'background', 'background-color', 'margin'];
@@ -5307,9 +5307,9 @@ jSuites.editor = (function(el, options) {
53075307
}
53085308
}
53095309
// Process image
5310-
if (element.tagName == 'IMG') {
5310+
if (element.tagName.toUpperCase() == 'IMG') {
53115311
if (! obj.options.acceptImages) {
5312-
element.remove();
5312+
element.parentNode.removeChild(element);
53135313
} else {
53145314
// Check if is data
53155315
element.setAttribute('tabindex', '900');
@@ -5345,9 +5345,11 @@ jSuites.editor = (function(el, options) {
53455345
if (data) {
53465346
data = data.replace(new RegExp('<!--(.*?)-->', 'gsi'), '');
53475347
}
5348+
var parser = new DOMParser();
5349+
var d = parser.parseFromString(data, "text/html");
5350+
parse(d);
53485351
var span = document.createElement('span');
5349-
span.innerHTML = data;
5350-
parse(span);
5352+
span.innerHTML = d.firstChild.innerHTML;
53515353
return span;
53525354
}
53535355

@@ -11019,7 +11021,8 @@ jSuites.tags = (function(el, options) {
1101911021
});
1102011022

1102111023
jSuites.toolbar = (function(el, options) {
11022-
var obj = {};
11024+
// New instance
11025+
var obj = { type:'toolbar' };
1102311026
obj.options = {};
1102411027

1102511028
// Default configuration
@@ -11029,6 +11032,7 @@ jSuites.toolbar = (function(el, options) {
1102911032
badge: false,
1103011033
title: false,
1103111034
responsive: false,
11035+
maxWidth: null,
1103211036
items: [],
1103311037
}
1103411038

@@ -11227,16 +11231,21 @@ jSuites.toolbar = (function(el, options) {
1122711231

1122811232
obj.refresh = function() {
1122911233
if (obj.options.responsive == true) {
11234+
// Width of the c
11235+
var rect = el.parentNode.getBoundingClientRect();
11236+
if (! obj.options.maxWidth) {
11237+
obj.options.maxWidth = rect.width;
11238+
}
11239+
// Max width
11240+
var width = parseInt(obj.options.maxWidth);
1123011241
// Remove arrow
1123111242
toolbarArrow.remove();
1123211243
// Move all items to the toolbar
1123311244
while (toolbarFloating.firstChild) {
1123411245
toolbarContent.appendChild(toolbarFloating.firstChild);
1123511246
}
11236-
// Width of the c
11237-
var rect = el.parentNode.getBoundingClientRect();
1123811247
// Available parent space
11239-
var available = rect.width;
11248+
var available = obj.options.maxWidth;
1124011249
// Toolbar is larger than the parent, move elements to the floating element
1124111250
if (available < toolbarContent.offsetWidth) {
1124211251
// Give space to the floating element

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"javascript plugins"
2020
],
2121
"main": "dist/jsuites.js",
22-
"version": "4.9.9",
22+
"version": "4.9.10",
2323
"bugs": "https://github.com/jsuites/jsuites/issues",
2424
"homepage": "https://github.com/jsuites/jsuites",
2525
"docs": "https://jsuites.net",

Diff for: src/contextmenu.css

+34
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,38 @@
9595
-webkit-transform: translate(0, 0) scale(1);
9696
transform: translate(0, 0) scale(1);
9797
pointer-events: auto;
98+
}
99+
100+
@media only screen and (max-width: 420px) {
101+
.jcontextmenu {
102+
top: initial !important;
103+
left: 0px !important;
104+
bottom: 0px !important;
105+
width: 100vw;
106+
height: 260px;
107+
overflow: scroll;
108+
animation: slide-bottom-in 0.4s forwards;
109+
}
110+
.jcontextmenu div {
111+
width: 100%;
112+
text-align: center;
113+
border-bottom: 1px solid #ccc;
114+
padding: 15px;
115+
}
116+
.jcontextmenu > div::before {
117+
display: none;
118+
}
119+
.jcontextmenu a {
120+
font-size: 1.4em;
121+
text-transform: uppercase;
122+
}
123+
.jcontextmenu span {
124+
display: none;
125+
}
126+
.jcontextmenu span {
127+
display: none;
128+
}
129+
.jcontextmenu hr {
130+
display: none;
131+
}
98132
}

Diff for: src/editor.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ jSuites.editor = (function(el, options) {
724724
}
725725

726726
// Elements to be removed
727-
var remove = [HTMLUnknownElement];
727+
var remove = [HTMLUnknownElement,HTMLAudioElement,HTMLEmbedElement,HTMLIFrameElement,HTMLTextAreaElement,HTMLInputElement,HTMLScriptElement];
728728

729729
// Valid CSS attributes
730730
var validStyle = ['color', 'font-weight', 'font-size', 'background', 'background-color', 'margin'];
@@ -749,9 +749,9 @@ jSuites.editor = (function(el, options) {
749749
}
750750
}
751751
// Process image
752-
if (element.tagName == 'IMG') {
752+
if (element.tagName.toUpperCase() == 'IMG') {
753753
if (! obj.options.acceptImages) {
754-
element.remove();
754+
element.parentNode.removeChild(element);
755755
} else {
756756
// Check if is data
757757
element.setAttribute('tabindex', '900');
@@ -787,9 +787,11 @@ jSuites.editor = (function(el, options) {
787787
if (data) {
788788
data = data.replace(new RegExp('<!--(.*?)-->', 'gsi'), '');
789789
}
790+
var parser = new DOMParser();
791+
var d = parser.parseFromString(data, "text/html");
792+
parse(d);
790793
var span = document.createElement('span');
791-
span.innerHTML = data;
792-
parse(span);
794+
span.innerHTML = d.firstChild.innerHTML;
793795
return span;
794796
}
795797

Diff for: src/toolbar.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
jSuites.toolbar = (function(el, options) {
2-
var obj = {};
2+
// New instance
3+
var obj = { type:'toolbar' };
34
obj.options = {};
45

56
// Default configuration
@@ -9,6 +10,7 @@ jSuites.toolbar = (function(el, options) {
910
badge: false,
1011
title: false,
1112
responsive: false,
13+
maxWidth: null,
1214
items: [],
1315
}
1416

@@ -207,16 +209,21 @@ jSuites.toolbar = (function(el, options) {
207209

208210
obj.refresh = function() {
209211
if (obj.options.responsive == true) {
212+
// Width of the c
213+
var rect = el.parentNode.getBoundingClientRect();
214+
if (! obj.options.maxWidth) {
215+
obj.options.maxWidth = rect.width;
216+
}
217+
// Max width
218+
var width = parseInt(obj.options.maxWidth);
210219
// Remove arrow
211220
toolbarArrow.remove();
212221
// Move all items to the toolbar
213222
while (toolbarFloating.firstChild) {
214223
toolbarContent.appendChild(toolbarFloating.firstChild);
215224
}
216-
// Width of the c
217-
var rect = el.parentNode.getBoundingClientRect();
218225
// Available parent space
219-
var available = rect.width;
226+
var available = obj.options.maxWidth;
220227
// Toolbar is larger than the parent, move elements to the floating element
221228
if (available < toolbarContent.offsetWidth) {
222229
// Give space to the floating element

0 commit comments

Comments
 (0)