@oat-sa/tao-core-ui 1.35.0 → 1.36.2
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/dist/datatable.js +8 -0
- package/dist/highlighter.js +82 -70
- package/dist/resourcemgr/fileBrowser.js +11 -5
- package/package.json +1 -1
- package/scss/inc/_forms.scss +1 -23
- package/src/datatable.js +7 -0
- package/src/highlighter.js +72 -62
- package/src/resourcemgr/fileBrowser.js +11 -5
- package/scss/.DS_Store +0 -0
- package/src/.DS_Store +0 -0
package/dist/datatable.js
CHANGED
|
@@ -1094,6 +1094,10 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/dompu
|
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
$$1.ajax(ajaxConfig).done(function (response) {
|
|
1097
|
+
if ($elt && _typeof($elt.data(dataNs)) !== 'object') {
|
|
1098
|
+
return $elt.trigger("error.".concat(ns), [new Error("Unable to load data attached to the element")]);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1097
1101
|
self._render($elt, response);
|
|
1098
1102
|
}).fail(function (response, option, err) {
|
|
1099
1103
|
var requestErr = httpErrorParser.parse(response, option, err);
|
|
@@ -1121,6 +1125,10 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/dompu
|
|
|
1121
1125
|
|
|
1122
1126
|
var options = _.cloneDeep($elt.data(dataNs));
|
|
1123
1127
|
|
|
1128
|
+
if (typeof options === 'undefined') {
|
|
1129
|
+
return $elt.trigger("error.".concat(ns), [new Error("Unable to load data attached to the element")]);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1124
1132
|
var model = [];
|
|
1125
1133
|
var $massActionBtns = $$1();
|
|
1126
1134
|
/**
|
package/dist/highlighter.js
CHANGED
|
@@ -104,13 +104,15 @@ define(['lodash', 'jquery'], function (_, $) { 'use strict';
|
|
|
104
104
|
return $(containerSelector).get(0);
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Returns all highlighted nodes
|
|
107
|
+
* Returns all highlighted nodes, excluding any inside blacklisted elements
|
|
108
108
|
* @returns {JQuery<HTMLElement>}
|
|
109
109
|
*/
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
function getHighlightedNodes() {
|
|
113
|
-
return $(containerSelector).find(".".concat(highlightingClasses.join(',.')))
|
|
113
|
+
return $(containerSelector).find(".".concat(highlightingClasses.join(',.'))).filter(function (i, node) {
|
|
114
|
+
return !isBlacklisted(node);
|
|
115
|
+
});
|
|
114
116
|
}
|
|
115
117
|
/**
|
|
116
118
|
* Attach data to wrapper node.
|
|
@@ -227,92 +229,100 @@ define(['lodash', 'jquery'], function (_, $) { 'use strict';
|
|
|
227
229
|
}
|
|
228
230
|
|
|
229
231
|
currentNode = childNodes[i];
|
|
230
|
-
var isCurrentNodeTextInsideOfAnotherHighlightingWrapper = isText(currentNode) && isWrappingNode(currentNode.parentNode) && currentNode.parentNode.className !== className;
|
|
231
|
-
|
|
232
|
-
if (isCurrentNodeTextInsideOfAnotherHighlightingWrapper) {
|
|
233
|
-
var internalRange = new Range();
|
|
234
|
-
internalRange.selectNodeContents(currentNode);
|
|
235
232
|
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
if (isBlacklisted(currentNode)) {
|
|
234
|
+
if (isElement(currentNode)) {
|
|
235
|
+
//go deeper in case a descendant of the current blacklisted is whitelisted
|
|
236
|
+
wrapTextNodesInRange(currentNode, rangeInfos);
|
|
238
237
|
}
|
|
238
|
+
} else {
|
|
239
|
+
var isCurrentNodeTextInsideOfAnotherHighlightingWrapper = isText(currentNode) && isWrappingNode(currentNode.parentNode) && currentNode.parentNode.className !== className;
|
|
239
240
|
|
|
240
|
-
if (
|
|
241
|
-
internalRange
|
|
242
|
-
|
|
241
|
+
if (isCurrentNodeTextInsideOfAnotherHighlightingWrapper) {
|
|
242
|
+
var internalRange = new Range();
|
|
243
|
+
internalRange.selectNodeContents(currentNode);
|
|
243
244
|
|
|
244
|
-
|
|
245
|
+
if (rangeInfos.startNode === currentNode) {
|
|
246
|
+
internalRange.setStart(currentNode, rangeInfos.startOffset);
|
|
247
|
+
}
|
|
245
248
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
highlightContainerNodes(currentNode, className, internalRange, currentGroupId);
|
|
249
|
-
}
|
|
250
|
-
} else {
|
|
251
|
-
// split current node in case the wrapping start/ends on a partially selected text node
|
|
252
|
-
if (currentNode.isSameNode(rangeInfos.startNode)) {
|
|
253
|
-
if (isText(rangeInfos.startNodeContainer) && rangeInfos.startOffset !== 0) {
|
|
254
|
-
// we defer the wrapping to the next iteration of the loop
|
|
255
|
-
//end of node should be highlighted
|
|
256
|
-
rangeInfos.startNode = currentNode.splitText(rangeInfos.startOffset);
|
|
257
|
-
rangeInfos.startOffset = 0;
|
|
258
|
-
splitDatas.push({
|
|
259
|
-
node: rangeInfos.startNode,
|
|
260
|
-
beforeWasSplit: true,
|
|
261
|
-
afterWasSplit: false
|
|
262
|
-
});
|
|
263
|
-
} else {
|
|
264
|
-
//whole node should be highlighted
|
|
265
|
-
isWrapping = true;
|
|
266
|
-
splitDatas.push({
|
|
267
|
-
node: currentNode,
|
|
268
|
-
beforeWasSplit: false,
|
|
269
|
-
afterWasSplit: false
|
|
270
|
-
});
|
|
249
|
+
if (rangeInfos.endNode === currentNode) {
|
|
250
|
+
internalRange.setEnd(currentNode, rangeInfos.endOffset);
|
|
271
251
|
}
|
|
272
|
-
}
|
|
273
252
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
253
|
+
var isNodeInRange = rangeInfos.commonRange.isPointInRange(currentNode, internalRange.endOffset); // Apply new highlighting color only for selected nodes
|
|
254
|
+
|
|
255
|
+
if (isNodeInRange) {
|
|
256
|
+
isWrapping = true;
|
|
257
|
+
highlightContainerNodes(currentNode, className, internalRange, currentGroupId);
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
// split current node in case the wrapping start/ends on a partially selected text node
|
|
261
|
+
if (currentNode.isSameNode(rangeInfos.startNode)) {
|
|
262
|
+
if (isText(rangeInfos.startNodeContainer) && rangeInfos.startOffset !== 0) {
|
|
263
|
+
// we defer the wrapping to the next iteration of the loop
|
|
264
|
+
//end of node should be highlighted
|
|
265
|
+
rangeInfos.startNode = currentNode.splitText(rangeInfos.startOffset);
|
|
266
|
+
rangeInfos.startOffset = 0;
|
|
279
267
|
splitDatas.push({
|
|
280
|
-
node:
|
|
281
|
-
beforeWasSplit:
|
|
282
|
-
afterWasSplit:
|
|
268
|
+
node: rangeInfos.startNode,
|
|
269
|
+
beforeWasSplit: true,
|
|
270
|
+
afterWasSplit: false
|
|
283
271
|
});
|
|
284
272
|
} else {
|
|
285
273
|
//whole node should be highlighted
|
|
274
|
+
isWrapping = true;
|
|
286
275
|
splitDatas.push({
|
|
287
276
|
node: currentNode,
|
|
288
277
|
beforeWasSplit: false,
|
|
289
278
|
afterWasSplit: false
|
|
290
279
|
});
|
|
291
280
|
}
|
|
292
|
-
} else {
|
|
293
|
-
isWrapping = false;
|
|
294
281
|
}
|
|
295
|
-
} // wrap the current node...
|
|
296
|
-
|
|
297
282
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
283
|
+
if (currentNode.isSameNode(rangeInfos.endNode) && isText(rangeInfos.endNodeContainer)) {
|
|
284
|
+
if (rangeInfos.endOffset !== 0) {
|
|
285
|
+
if (rangeInfos.endOffset < currentNode.textContent.length) {
|
|
286
|
+
//start of node should be highlighted
|
|
287
|
+
currentNode.splitText(rangeInfos.endOffset);
|
|
288
|
+
splitDatas.push({
|
|
289
|
+
node: currentNode,
|
|
290
|
+
beforeWasSplit: false,
|
|
291
|
+
afterWasSplit: true
|
|
292
|
+
});
|
|
293
|
+
} else {
|
|
294
|
+
//whole node should be highlighted
|
|
295
|
+
splitDatas.push({
|
|
296
|
+
node: currentNode,
|
|
297
|
+
beforeWasSplit: false,
|
|
298
|
+
afterWasSplit: false
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
} else {
|
|
302
|
+
isWrapping = false;
|
|
303
|
+
}
|
|
304
|
+
} // wrap the current node...
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
if (isText(currentNode)) {
|
|
308
|
+
if (!keepEmptyNodes) {
|
|
309
|
+
wrapTextNode(currentNode, currentGroupId);
|
|
310
|
+
} else if (willHighlightNotBeEmptyAfterMerge(currentNode)) {
|
|
311
|
+
var wrapperNode = wrapTextNode(currentNode, currentGroupId);
|
|
312
|
+
|
|
313
|
+
if (wrapperNode) {
|
|
314
|
+
var splitData = splitDatas.find(function (d) {
|
|
315
|
+
return d.node === currentNode;
|
|
316
|
+
});
|
|
317
|
+
addSplitData(wrapperNode, splitData ? splitData.beforeWasSplit : false, splitData ? splitData.afterWasSplit : false);
|
|
318
|
+
}
|
|
319
|
+
} // ... or continue deeper in the node tree
|
|
320
|
+
|
|
321
|
+
} else if (isElement(currentNode)) {
|
|
322
|
+
//some selections end at the very start of the next node, we should end wrapping when we reach such node
|
|
323
|
+
if (!currentNode.isSameNode(rangeInfos.endNode) || rangeInfos.endOffset > 0) {
|
|
324
|
+
wrapTextNodesInRange(currentNode, rangeInfos);
|
|
309
325
|
}
|
|
310
|
-
} // ... or continue deeper in the node tree
|
|
311
|
-
|
|
312
|
-
} else if (isElement(currentNode)) {
|
|
313
|
-
//some selections end at the very start of the next node, we should end wrapping when we reach such node
|
|
314
|
-
if (!currentNode.isSameNode(rangeInfos.endNode) || rangeInfos.endOffset > 0) {
|
|
315
|
-
wrapTextNodesInRange(currentNode, rangeInfos);
|
|
316
326
|
}
|
|
317
327
|
}
|
|
318
328
|
} // end wrapping ?
|
|
@@ -794,7 +804,7 @@ define(['lodash', 'jquery'], function (_, $) { 'use strict';
|
|
|
794
804
|
|
|
795
805
|
/**
|
|
796
806
|
* For `keepEmptyNodes` option, creates data model of highlights.
|
|
797
|
-
* Additionally returns array of
|
|
807
|
+
* Additionally returns array of highlight nodes. Traverses DOM tree.
|
|
798
808
|
* @param {Node} rootNode
|
|
799
809
|
* @returns {BuildModelResultKeepEmpty|null} result
|
|
800
810
|
*/
|
|
@@ -805,7 +815,9 @@ define(['lodash', 'jquery'], function (_, $) { 'use strict';
|
|
|
805
815
|
var wrapperNodesSelector = classNames.map(function (cls) {
|
|
806
816
|
return containerSelector + ' .' + cls;
|
|
807
817
|
}).join(', ');
|
|
808
|
-
var wrapperNodes = document.querySelectorAll(wrapperNodesSelector)
|
|
818
|
+
var wrapperNodes = Array.from(document.querySelectorAll(wrapperNodesSelector)).filter(function (node) {
|
|
819
|
+
return !isBlacklisted(node);
|
|
820
|
+
});
|
|
809
821
|
|
|
810
822
|
if (!wrapperNodes.length) {
|
|
811
823
|
return null;
|
|
@@ -304,12 +304,18 @@ define(['jquery', 'lodash', 'core/request', 'ui/pagination', 'handlebars', 'i18n
|
|
|
304
304
|
$rootNode.addClass('opened');
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
-
updateFolders(content, $innerList);
|
|
307
|
+
updateFolders(content, $innerList);
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
309
|
+
if (content.permissions.read && !options.hasAlreadySelected) {
|
|
310
|
+
$$1('.file-browser').find('li.active').removeClass('active');
|
|
311
|
+
updateSelectedClass(content.path, content.total, content.childrenLimit);
|
|
312
|
+
$container.trigger("folderselect.".concat(ns), [content.label, getPage(content.children), content.path, content]);
|
|
313
|
+
renderPagination();
|
|
314
|
+
|
|
315
|
+
if (root !== 'local') {
|
|
316
|
+
options.hasAlreadySelected = true;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
313
319
|
}); // by clicking on the tree (using a live binding because content is not complete yet)
|
|
314
320
|
|
|
315
321
|
$divContainer.off('click', '.folders a').on('click', '.folders a', function (e) {
|
package/package.json
CHANGED
package/scss/inc/_forms.scss
CHANGED
|
@@ -25,10 +25,6 @@ label, .form_desc {
|
|
|
25
25
|
margin-bottom: 5px;
|
|
26
26
|
padding-right: 10px;
|
|
27
27
|
|
|
28
|
-
[dir="rtl"] & {
|
|
29
|
-
padding-right: 0;
|
|
30
|
-
padding-left: 10px;
|
|
31
|
-
}
|
|
32
28
|
abbr {
|
|
33
29
|
color: $info;
|
|
34
30
|
border-bottom: none;
|
|
@@ -219,18 +215,9 @@ label, .form_desc {
|
|
|
219
215
|
margin: 0;
|
|
220
216
|
left: 0;
|
|
221
217
|
|
|
222
|
-
[dir="rtl"] & {
|
|
223
|
-
left: auto;
|
|
224
|
-
right: 0;
|
|
225
|
-
}
|
|
226
218
|
& + div {
|
|
227
219
|
cursor: pointer;
|
|
228
220
|
margin-left: 24px;
|
|
229
|
-
|
|
230
|
-
[dir="rtl"] & {
|
|
231
|
-
margin-left: 0;
|
|
232
|
-
margin-right: 24px;
|
|
233
|
-
}
|
|
234
221
|
}
|
|
235
222
|
}
|
|
236
223
|
abbr {
|
|
@@ -416,17 +403,11 @@ label {
|
|
|
416
403
|
}
|
|
417
404
|
&:before {
|
|
418
405
|
z-index: 3;
|
|
419
|
-
[dir="rtl"] & {
|
|
420
|
-
right: -1em;
|
|
421
|
-
}
|
|
422
406
|
}
|
|
423
407
|
&:after {
|
|
424
408
|
position: relative;
|
|
425
409
|
z-index: 2;
|
|
426
410
|
left: -1em;
|
|
427
|
-
[dir="rtl"] & {
|
|
428
|
-
left: auto;
|
|
429
|
-
}
|
|
430
411
|
}
|
|
431
412
|
}
|
|
432
413
|
input[type="radio"],
|
|
@@ -710,14 +691,11 @@ label {
|
|
|
710
691
|
width: 35%;
|
|
711
692
|
display:inline-block;
|
|
712
693
|
padding: 0 10px 0 0;
|
|
694
|
+
vertical-align: top;
|
|
713
695
|
|
|
714
|
-
[dir="rtl"] & {
|
|
715
|
-
padding: 0 0 0 10px;
|
|
716
|
-
}
|
|
717
696
|
&.hidden-input-label {
|
|
718
697
|
width: auto;
|
|
719
698
|
}
|
|
720
|
-
vertical-align: top;
|
|
721
699
|
|
|
722
700
|
& ~ .form-elt-container {
|
|
723
701
|
display: inline-block;
|
package/src/datatable.js
CHANGED
|
@@ -355,6 +355,9 @@ const dataTable = {
|
|
|
355
355
|
|
|
356
356
|
$.ajax(ajaxConfig)
|
|
357
357
|
.done(function (response) {
|
|
358
|
+
if($elt && typeof $elt.data(dataNs) !== 'object'){
|
|
359
|
+
return $elt.trigger(`error.${ns}`, [new Error(`Unable to load data attached to the element`)]);
|
|
360
|
+
}
|
|
358
361
|
self._render($elt, response);
|
|
359
362
|
})
|
|
360
363
|
.fail(function (response, option, err) {
|
|
@@ -380,6 +383,10 @@ const dataTable = {
|
|
|
380
383
|
_render($elt, dataset = {}) {
|
|
381
384
|
const self = this;
|
|
382
385
|
let options = _.cloneDeep($elt.data(dataNs));
|
|
386
|
+
if(typeof options === 'undefined') {
|
|
387
|
+
return $elt.trigger(`error.${ns}`, [new Error(`Unable to load data attached to the element`)]);
|
|
388
|
+
}
|
|
389
|
+
|
|
383
390
|
const model = [];
|
|
384
391
|
let $massActionBtns = $();
|
|
385
392
|
|
package/src/highlighter.js
CHANGED
|
@@ -106,11 +106,13 @@ export default function (options) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* Returns all highlighted nodes
|
|
109
|
+
* Returns all highlighted nodes, excluding any inside blacklisted elements
|
|
110
110
|
* @returns {JQuery<HTMLElement>}
|
|
111
111
|
*/
|
|
112
112
|
function getHighlightedNodes() {
|
|
113
|
-
return $(containerSelector)
|
|
113
|
+
return $(containerSelector)
|
|
114
|
+
.find(`.${highlightingClasses.join(',.')}`)
|
|
115
|
+
.filter((i, node) => !isBlacklisted(node));
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
/**
|
|
@@ -242,80 +244,87 @@ export default function (options) {
|
|
|
242
244
|
}
|
|
243
245
|
currentNode = childNodes[i];
|
|
244
246
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
if (isBlacklisted(currentNode)) {
|
|
248
|
+
if (isElement(currentNode)) {
|
|
249
|
+
//go deeper in case a descendant of the current blacklisted is whitelisted
|
|
250
|
+
wrapTextNodesInRange(currentNode, rangeInfos);
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
const isCurrentNodeTextInsideOfAnotherHighlightingWrapper =
|
|
254
|
+
isText(currentNode) &&
|
|
255
|
+
isWrappingNode(currentNode.parentNode) &&
|
|
256
|
+
currentNode.parentNode.className !== className;
|
|
249
257
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
258
|
+
if (isCurrentNodeTextInsideOfAnotherHighlightingWrapper) {
|
|
259
|
+
const internalRange = new Range();
|
|
260
|
+
internalRange.selectNodeContents(currentNode);
|
|
253
261
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
262
|
+
if (rangeInfos.startNode === currentNode) {
|
|
263
|
+
internalRange.setStart(currentNode, rangeInfos.startOffset);
|
|
264
|
+
}
|
|
257
265
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
266
|
+
if (rangeInfos.endNode === currentNode) {
|
|
267
|
+
internalRange.setEnd(currentNode, rangeInfos.endOffset);
|
|
268
|
+
}
|
|
261
269
|
|
|
262
|
-
|
|
270
|
+
const isNodeInRange = rangeInfos.commonRange.isPointInRange(currentNode, internalRange.endOffset);
|
|
263
271
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
isWrapping = true;
|
|
267
|
-
highlightContainerNodes(currentNode, className, internalRange, currentGroupId);
|
|
268
|
-
}
|
|
269
|
-
} else {
|
|
270
|
-
// split current node in case the wrapping start/ends on a partially selected text node
|
|
271
|
-
if (currentNode.isSameNode(rangeInfos.startNode)) {
|
|
272
|
-
if (isText(rangeInfos.startNodeContainer) && rangeInfos.startOffset !== 0) {
|
|
273
|
-
// we defer the wrapping to the next iteration of the loop
|
|
274
|
-
//end of node should be highlighted
|
|
275
|
-
rangeInfos.startNode = currentNode.splitText(rangeInfos.startOffset);
|
|
276
|
-
rangeInfos.startOffset = 0;
|
|
277
|
-
splitDatas.push({ node: rangeInfos.startNode, beforeWasSplit: true, afterWasSplit: false });
|
|
278
|
-
} else {
|
|
279
|
-
//whole node should be highlighted
|
|
272
|
+
// Apply new highlighting color only for selected nodes
|
|
273
|
+
if (isNodeInRange) {
|
|
280
274
|
isWrapping = true;
|
|
281
|
-
|
|
275
|
+
highlightContainerNodes(currentNode, className, internalRange, currentGroupId);
|
|
282
276
|
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
//
|
|
289
|
-
currentNode.splitText(rangeInfos.
|
|
290
|
-
|
|
277
|
+
} else {
|
|
278
|
+
// split current node in case the wrapping start/ends on a partially selected text node
|
|
279
|
+
if (currentNode.isSameNode(rangeInfos.startNode)) {
|
|
280
|
+
if (isText(rangeInfos.startNodeContainer) && rangeInfos.startOffset !== 0) {
|
|
281
|
+
// we defer the wrapping to the next iteration of the loop
|
|
282
|
+
//end of node should be highlighted
|
|
283
|
+
rangeInfos.startNode = currentNode.splitText(rangeInfos.startOffset);
|
|
284
|
+
rangeInfos.startOffset = 0;
|
|
285
|
+
splitDatas.push({ node: rangeInfos.startNode, beforeWasSplit: true, afterWasSplit: false });
|
|
291
286
|
} else {
|
|
292
287
|
//whole node should be highlighted
|
|
288
|
+
isWrapping = true;
|
|
293
289
|
splitDatas.push({ node: currentNode, beforeWasSplit: false, afterWasSplit: false });
|
|
294
290
|
}
|
|
295
|
-
} else {
|
|
296
|
-
isWrapping = false;
|
|
297
291
|
}
|
|
298
|
-
}
|
|
299
292
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
293
|
+
if (currentNode.isSameNode(rangeInfos.endNode) && isText(rangeInfos.endNodeContainer)) {
|
|
294
|
+
if (rangeInfos.endOffset !== 0) {
|
|
295
|
+
if (rangeInfos.endOffset < currentNode.textContent.length) {
|
|
296
|
+
//start of node should be highlighted
|
|
297
|
+
currentNode.splitText(rangeInfos.endOffset);
|
|
298
|
+
splitDatas.push({ node: currentNode, beforeWasSplit: false, afterWasSplit: true });
|
|
299
|
+
} else {
|
|
300
|
+
//whole node should be highlighted
|
|
301
|
+
splitDatas.push({ node: currentNode, beforeWasSplit: false, afterWasSplit: false });
|
|
302
|
+
}
|
|
303
|
+
} else {
|
|
304
|
+
isWrapping = false;
|
|
311
305
|
}
|
|
312
306
|
}
|
|
313
307
|
|
|
314
|
-
//
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
308
|
+
// wrap the current node...
|
|
309
|
+
if (isText(currentNode)) {
|
|
310
|
+
if (!keepEmptyNodes) {
|
|
311
|
+
wrapTextNode(currentNode, currentGroupId);
|
|
312
|
+
} else if (willHighlightNotBeEmptyAfterMerge(currentNode)) {
|
|
313
|
+
const wrapperNode = wrapTextNode(currentNode, currentGroupId);
|
|
314
|
+
if (wrapperNode) {
|
|
315
|
+
const splitData = splitDatas.find(d => d.node === currentNode);
|
|
316
|
+
addSplitData(wrapperNode,
|
|
317
|
+
splitData ? splitData.beforeWasSplit : false,
|
|
318
|
+
splitData ? splitData.afterWasSplit : false);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// ... or continue deeper in the node tree
|
|
323
|
+
} else if (isElement(currentNode)) {
|
|
324
|
+
//some selections end at the very start of the next node, we should end wrapping when we reach such node
|
|
325
|
+
if (!currentNode.isSameNode(rangeInfos.endNode) || rangeInfos.endOffset > 0) {
|
|
326
|
+
wrapTextNodesInRange(currentNode, rangeInfos);
|
|
327
|
+
}
|
|
319
328
|
}
|
|
320
329
|
}
|
|
321
330
|
}
|
|
@@ -796,14 +805,15 @@ export default function (options) {
|
|
|
796
805
|
*/
|
|
797
806
|
/**
|
|
798
807
|
* For `keepEmptyNodes` option, creates data model of highlights.
|
|
799
|
-
* Additionally returns array of
|
|
808
|
+
* Additionally returns array of highlight nodes. Traverses DOM tree.
|
|
800
809
|
* @param {Node} rootNode
|
|
801
810
|
* @returns {BuildModelResultKeepEmpty|null} result
|
|
802
811
|
*/
|
|
803
812
|
function buildHighlightModelKeepEmpty(rootNode) {
|
|
804
813
|
const classNames = options.colors ? Object.values(options.colors) : [className];
|
|
805
814
|
const wrapperNodesSelector = classNames.map(cls => containerSelector + ' .' + cls).join(', ');
|
|
806
|
-
const wrapperNodes = document.querySelectorAll(wrapperNodesSelector)
|
|
815
|
+
const wrapperNodes = Array.from(document.querySelectorAll(wrapperNodesSelector))
|
|
816
|
+
.filter(node => !isBlacklisted(node));
|
|
807
817
|
|
|
808
818
|
if (!wrapperNodes.length) {
|
|
809
819
|
return null;
|
|
@@ -53,11 +53,17 @@ export default function (options) {
|
|
|
53
53
|
$rootNode.addClass('opened');
|
|
54
54
|
}
|
|
55
55
|
updateFolders(content, $innerList);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
|
|
57
|
+
if (content.permissions.read && !options.hasAlreadySelected) {
|
|
58
|
+
$('.file-browser').find('li.active').removeClass('active');
|
|
59
|
+
updateSelectedClass(content.path, content.total, content.childrenLimit);
|
|
60
|
+
$container.trigger("folderselect.".concat(ns), [content.label, getPage(content.children), content.path, content]);
|
|
61
|
+
renderPagination();
|
|
62
|
+
|
|
63
|
+
if (root !== 'local') {
|
|
64
|
+
options.hasAlreadySelected = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
61
67
|
});
|
|
62
68
|
|
|
63
69
|
// by clicking on the tree (using a live binding because content is not complete yet)
|
package/scss/.DS_Store
DELETED
|
Binary file
|
package/src/.DS_Store
DELETED
|
Binary file
|