tinymce-rails 4.9.10 → 4.9.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/app/assets/source/tinymce/tinymce.js +137 -120
- data/lib/tinymce/rails/asset_installer/compile.rb +2 -2
- data/lib/tinymce/rails/asset_installer.rb +1 -1
- data/lib/tinymce/rails/asset_manifest.rb +9 -4
- data/lib/tinymce/rails/configuration.rb +2 -2
- data/lib/tinymce/rails/configuration_file.rb +4 -3
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9119c17e2bcb3d33ab9b959c0c6c41c8d529106e51ab483f338d1e64423481d4
|
4
|
+
data.tar.gz: 7e358486b6a0f1db1794349cfeb7413538208df73d14bc3b6d221d2069222c91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5222c58b96aabcf11ea4e41328be95d4f6461aaab3406dc148b5cff078b5d4f2b12c96ca01c5f3c5c83d8c6a9730667afd57640e6c54b4a3e7ef27d57af28bfa
|
7
|
+
data.tar.gz: ec2c6ed08479406cbc7829e702557b9ea9a754f5ab091e9119d216150b463fcfcc061dd83f6d2e8b719aa203dd9b68cd24c4117c3370b4aafd4158cf1604c911
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Rails Integration for TinyMCE
|
2
2
|
=============================
|
3
3
|
|
4
|
-
The `tinymce-rails` gem integrates the [TinyMCE](
|
4
|
+
The `tinymce-rails` gem integrates the [TinyMCE](https://www.tiny.cloud/) editor with the Rails asset pipeline.
|
5
5
|
|
6
|
-
This gem is compatible with Rails
|
6
|
+
This gem is compatible with Rails 5.0 and higher.
|
7
7
|
|
8
|
-
This is the branch for TinyMCE 4.
|
8
|
+
This is the branch for TinyMCE 4. Please see the [`main`](https://github.com/spohlenz/tinymce-rails) branch for TinyMCE 7, and alternate branches for [TinyMCE 6](https://github.com/spohlenz/tinymce-rails/tree/tinymce-6), [TinyMCE 5](https://github.com/spohlenz/tinymce-rails/tree/tinymce-5) & [TinyMCE 3.5.x](https://github.com/spohlenz/tinymce-rails/tree/tinymce-3).
|
9
9
|
|
10
|
-
[![Build Status](https://
|
10
|
+
[![Build Status](https://img.shields.io/github/actions/workflow/status/spohlenz/tinymce-rails/rspec.yml?branch=tinymce-4)](https://github.com/spohlenz/tinymce-rails/actions?query=branch%3Atinymce-4)
|
11
11
|
|
12
12
|
**New in 3.5.11, 4.1.10 and 4.2.1:** Alternative asset installation methods (copy vs compile/symlink). See the [Asset Compilation](#asset-compilation) section below for details.
|
13
13
|
|
@@ -52,7 +52,7 @@ alternate:
|
|
52
52
|
- table
|
53
53
|
```
|
54
54
|
|
55
|
-
See the [TinyMCE 4 Documentation](https://www.
|
55
|
+
See the [TinyMCE 4 Documentation](https://www.tiny.cloud/docs-4x/configure/) for a full list of configuration options.
|
56
56
|
|
57
57
|
|
58
58
|
**3. Include the TinyMCE assets**
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// 4.9.
|
1
|
+
// 4.9.11 (2020-07-13)
|
2
2
|
(function () {
|
3
3
|
(function (domGlobals) {
|
4
4
|
'use strict';
|
@@ -5657,7 +5657,7 @@
|
|
5657
5657
|
textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + 'blockquote center dir fieldset header footer article section hgroup aside main nav figure');
|
5658
5658
|
blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + 'datalist select optgroup figcaption details summary', textBlockElementsMap);
|
5659
5659
|
textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + 'dfn code mark q sup sub samp');
|
5660
|
-
each$4((settings.special || 'script noscript noframes noembed title style textarea xmp').split(' '), function (name) {
|
5660
|
+
each$4((settings.special || 'script noscript iframe noframes noembed title style textarea xmp').split(' '), function (name) {
|
5661
5661
|
specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');
|
5662
5662
|
});
|
5663
5663
|
var patternToRegExp = function (str) {
|
@@ -8103,7 +8103,8 @@
|
|
8103
8103
|
return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2;
|
8104
8104
|
};
|
8105
8105
|
var isAbove = function (rect1, rect2) {
|
8106
|
-
|
8106
|
+
var halfHeight = Math.min(rect2.height / 2, rect1.height / 2);
|
8107
|
+
if (rect1.bottom - halfHeight < rect2.top) {
|
8107
8108
|
return true;
|
8108
8109
|
}
|
8109
8110
|
if (rect1.top > rect2.bottom) {
|
@@ -13290,6 +13291,99 @@
|
|
13290
13291
|
};
|
13291
13292
|
var InlineFormatDelete = { backspaceDelete: backspaceDelete$5 };
|
13292
13293
|
|
13294
|
+
var getPos$1 = function (elm) {
|
13295
|
+
var x = 0, y = 0;
|
13296
|
+
var offsetParent = elm;
|
13297
|
+
while (offsetParent && offsetParent.nodeType) {
|
13298
|
+
x += offsetParent.offsetLeft || 0;
|
13299
|
+
y += offsetParent.offsetTop || 0;
|
13300
|
+
offsetParent = offsetParent.offsetParent;
|
13301
|
+
}
|
13302
|
+
return {
|
13303
|
+
x: x,
|
13304
|
+
y: y
|
13305
|
+
};
|
13306
|
+
};
|
13307
|
+
var fireScrollIntoViewEvent = function (editor, elm, alignToTop) {
|
13308
|
+
var scrollEvent = {
|
13309
|
+
elm: elm,
|
13310
|
+
alignToTop: alignToTop
|
13311
|
+
};
|
13312
|
+
editor.fire('scrollIntoView', scrollEvent);
|
13313
|
+
return scrollEvent.isDefaultPrevented();
|
13314
|
+
};
|
13315
|
+
var scrollElementIntoView = function (editor, elm, alignToTop) {
|
13316
|
+
var y, viewPort;
|
13317
|
+
var dom = editor.dom;
|
13318
|
+
var root = dom.getRoot();
|
13319
|
+
var viewPortY, viewPortH, offsetY = 0;
|
13320
|
+
if (fireScrollIntoViewEvent(editor, elm, alignToTop)) {
|
13321
|
+
return;
|
13322
|
+
}
|
13323
|
+
if (!NodeType.isElement(elm)) {
|
13324
|
+
return;
|
13325
|
+
}
|
13326
|
+
if (alignToTop === false) {
|
13327
|
+
offsetY = elm.offsetHeight;
|
13328
|
+
}
|
13329
|
+
if (root.nodeName !== 'BODY') {
|
13330
|
+
var scrollContainer = editor.selection.getScrollContainer();
|
13331
|
+
if (scrollContainer) {
|
13332
|
+
y = getPos$1(elm).y - getPos$1(scrollContainer).y + offsetY;
|
13333
|
+
viewPortH = scrollContainer.clientHeight;
|
13334
|
+
viewPortY = scrollContainer.scrollTop;
|
13335
|
+
if (y < viewPortY || y + 25 > viewPortY + viewPortH) {
|
13336
|
+
scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;
|
13337
|
+
}
|
13338
|
+
return;
|
13339
|
+
}
|
13340
|
+
}
|
13341
|
+
viewPort = dom.getViewPort(editor.getWin());
|
13342
|
+
y = dom.getPos(elm).y + offsetY;
|
13343
|
+
viewPortY = viewPort.y;
|
13344
|
+
viewPortH = viewPort.h;
|
13345
|
+
if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {
|
13346
|
+
editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);
|
13347
|
+
}
|
13348
|
+
};
|
13349
|
+
var getViewPortRect = function (editor) {
|
13350
|
+
if (editor.inline) {
|
13351
|
+
return editor.getBody().getBoundingClientRect();
|
13352
|
+
} else {
|
13353
|
+
var win = editor.getWin();
|
13354
|
+
return {
|
13355
|
+
left: 0,
|
13356
|
+
right: win.innerWidth,
|
13357
|
+
top: 0,
|
13358
|
+
bottom: win.innerHeight,
|
13359
|
+
width: win.innerWidth,
|
13360
|
+
height: win.innerHeight
|
13361
|
+
};
|
13362
|
+
}
|
13363
|
+
};
|
13364
|
+
var scrollBy = function (editor, dx, dy) {
|
13365
|
+
if (editor.inline) {
|
13366
|
+
editor.getBody().scrollLeft += dx;
|
13367
|
+
editor.getBody().scrollTop += dy;
|
13368
|
+
} else {
|
13369
|
+
editor.getWin().scrollBy(dx, dy);
|
13370
|
+
}
|
13371
|
+
};
|
13372
|
+
var scrollRangeIntoView = function (editor, rng) {
|
13373
|
+
head(CaretPosition.fromRangeStart(rng).getClientRects()).each(function (rngRect) {
|
13374
|
+
var bodyRect = getViewPortRect(editor);
|
13375
|
+
var overflow = getOverflow(bodyRect, rngRect);
|
13376
|
+
var margin = 4;
|
13377
|
+
var dx = overflow.x > 0 ? overflow.x + margin : overflow.x - margin;
|
13378
|
+
var dy = overflow.y > 0 ? overflow.y + margin : overflow.y - margin;
|
13379
|
+
scrollBy(editor, overflow.x !== 0 ? dx : 0, overflow.y !== 0 ? dy : 0);
|
13380
|
+
});
|
13381
|
+
};
|
13382
|
+
var ScrollIntoView = {
|
13383
|
+
scrollElementIntoView: scrollElementIntoView,
|
13384
|
+
scrollRangeIntoView: scrollRangeIntoView
|
13385
|
+
};
|
13386
|
+
|
13293
13387
|
var isContentEditableTrue$2 = NodeType.isContentEditableTrue;
|
13294
13388
|
var isContentEditableFalse$6 = NodeType.isContentEditableFalse;
|
13295
13389
|
var showCaret = function (direction, editor, node, before, scrollIntoView) {
|
@@ -13336,6 +13430,10 @@
|
|
13336
13430
|
}
|
13337
13431
|
return range;
|
13338
13432
|
};
|
13433
|
+
var moveToRange = function (editor, rng) {
|
13434
|
+
editor.selection.setRng(rng);
|
13435
|
+
ScrollIntoView.scrollRangeIntoView(editor, editor.selection.getRng());
|
13436
|
+
};
|
13339
13437
|
|
13340
13438
|
var trimEmptyTextNode$1 = function (dom, node) {
|
13341
13439
|
if (NodeType.isText(node) && node.data.length === 0) {
|
@@ -20415,7 +20513,7 @@
|
|
20415
20513
|
var blockElements = Tools.extend({}, schema.getBlockElements());
|
20416
20514
|
var nonEmptyElements = schema.getNonEmptyElements();
|
20417
20515
|
var parent, lastParent, prev, prevName;
|
20418
|
-
var whiteSpaceElements = schema.
|
20516
|
+
var whiteSpaceElements = schema.getWhiteSpaceElements();
|
20419
20517
|
var elementRule, textNode;
|
20420
20518
|
blockElements.body = 1;
|
20421
20519
|
for (i = 0; i < l; i++) {
|
@@ -21490,99 +21588,6 @@
|
|
21490
21588
|
};
|
21491
21589
|
};
|
21492
21590
|
|
21493
|
-
var getPos$1 = function (elm) {
|
21494
|
-
var x = 0, y = 0;
|
21495
|
-
var offsetParent = elm;
|
21496
|
-
while (offsetParent && offsetParent.nodeType) {
|
21497
|
-
x += offsetParent.offsetLeft || 0;
|
21498
|
-
y += offsetParent.offsetTop || 0;
|
21499
|
-
offsetParent = offsetParent.offsetParent;
|
21500
|
-
}
|
21501
|
-
return {
|
21502
|
-
x: x,
|
21503
|
-
y: y
|
21504
|
-
};
|
21505
|
-
};
|
21506
|
-
var fireScrollIntoViewEvent = function (editor, elm, alignToTop) {
|
21507
|
-
var scrollEvent = {
|
21508
|
-
elm: elm,
|
21509
|
-
alignToTop: alignToTop
|
21510
|
-
};
|
21511
|
-
editor.fire('scrollIntoView', scrollEvent);
|
21512
|
-
return scrollEvent.isDefaultPrevented();
|
21513
|
-
};
|
21514
|
-
var scrollElementIntoView = function (editor, elm, alignToTop) {
|
21515
|
-
var y, viewPort;
|
21516
|
-
var dom = editor.dom;
|
21517
|
-
var root = dom.getRoot();
|
21518
|
-
var viewPortY, viewPortH, offsetY = 0;
|
21519
|
-
if (fireScrollIntoViewEvent(editor, elm, alignToTop)) {
|
21520
|
-
return;
|
21521
|
-
}
|
21522
|
-
if (!NodeType.isElement(elm)) {
|
21523
|
-
return;
|
21524
|
-
}
|
21525
|
-
if (alignToTop === false) {
|
21526
|
-
offsetY = elm.offsetHeight;
|
21527
|
-
}
|
21528
|
-
if (root.nodeName !== 'BODY') {
|
21529
|
-
var scrollContainer = editor.selection.getScrollContainer();
|
21530
|
-
if (scrollContainer) {
|
21531
|
-
y = getPos$1(elm).y - getPos$1(scrollContainer).y + offsetY;
|
21532
|
-
viewPortH = scrollContainer.clientHeight;
|
21533
|
-
viewPortY = scrollContainer.scrollTop;
|
21534
|
-
if (y < viewPortY || y + 25 > viewPortY + viewPortH) {
|
21535
|
-
scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;
|
21536
|
-
}
|
21537
|
-
return;
|
21538
|
-
}
|
21539
|
-
}
|
21540
|
-
viewPort = dom.getViewPort(editor.getWin());
|
21541
|
-
y = dom.getPos(elm).y + offsetY;
|
21542
|
-
viewPortY = viewPort.y;
|
21543
|
-
viewPortH = viewPort.h;
|
21544
|
-
if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {
|
21545
|
-
editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);
|
21546
|
-
}
|
21547
|
-
};
|
21548
|
-
var getViewPortRect = function (editor) {
|
21549
|
-
if (editor.inline) {
|
21550
|
-
return editor.getBody().getBoundingClientRect();
|
21551
|
-
} else {
|
21552
|
-
var win = editor.getWin();
|
21553
|
-
return {
|
21554
|
-
left: 0,
|
21555
|
-
right: win.innerWidth,
|
21556
|
-
top: 0,
|
21557
|
-
bottom: win.innerHeight,
|
21558
|
-
width: win.innerWidth,
|
21559
|
-
height: win.innerHeight
|
21560
|
-
};
|
21561
|
-
}
|
21562
|
-
};
|
21563
|
-
var scrollBy = function (editor, dx, dy) {
|
21564
|
-
if (editor.inline) {
|
21565
|
-
editor.getBody().scrollLeft += dx;
|
21566
|
-
editor.getBody().scrollTop += dy;
|
21567
|
-
} else {
|
21568
|
-
editor.getWin().scrollBy(dx, dy);
|
21569
|
-
}
|
21570
|
-
};
|
21571
|
-
var scrollRangeIntoView = function (editor, rng) {
|
21572
|
-
head(CaretPosition.fromRangeStart(rng).getClientRects()).each(function (rngRect) {
|
21573
|
-
var bodyRect = getViewPortRect(editor);
|
21574
|
-
var overflow = getOverflow(bodyRect, rngRect);
|
21575
|
-
var margin = 4;
|
21576
|
-
var dx = overflow.x > 0 ? overflow.x + margin : overflow.x - margin;
|
21577
|
-
var dy = overflow.y > 0 ? overflow.y + margin : overflow.y - margin;
|
21578
|
-
scrollBy(editor, overflow.x !== 0 ? dx : 0, overflow.y !== 0 ? dy : 0);
|
21579
|
-
});
|
21580
|
-
};
|
21581
|
-
var ScrollIntoView = {
|
21582
|
-
scrollElementIntoView: scrollElementIntoView,
|
21583
|
-
scrollRangeIntoView: scrollRangeIntoView
|
21584
|
-
};
|
21585
|
-
|
21586
21591
|
var hasCeProperty = function (node) {
|
21587
21592
|
return NodeType.isContentEditableTrue(node) || NodeType.isContentEditableFalse(node);
|
21588
21593
|
};
|
@@ -21901,22 +21906,37 @@
|
|
21901
21906
|
};
|
21902
21907
|
var GetSelectionContent = { getContent: getContent };
|
21903
21908
|
|
21909
|
+
var setupArgs = function (args, content) {
|
21910
|
+
return __assign(__assign({ format: 'html' }, args), {
|
21911
|
+
set: true,
|
21912
|
+
selection: true,
|
21913
|
+
content: content
|
21914
|
+
});
|
21915
|
+
};
|
21916
|
+
var cleanContent = function (editor, args) {
|
21917
|
+
if (args.format !== 'raw') {
|
21918
|
+
var node = editor.parser.parse(args.content, __assign({
|
21919
|
+
isRootContent: true,
|
21920
|
+
forced_root_block: false
|
21921
|
+
}, args));
|
21922
|
+
return HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(node);
|
21923
|
+
} else {
|
21924
|
+
return args.content;
|
21925
|
+
}
|
21926
|
+
};
|
21904
21927
|
var setContent = function (editor, content, args) {
|
21928
|
+
var contentArgs = setupArgs(args, content);
|
21905
21929
|
var rng = editor.selection.getRng(), caretNode;
|
21906
21930
|
var doc = editor.getDoc();
|
21907
21931
|
var frag, temp;
|
21908
|
-
|
21909
|
-
|
21910
|
-
|
21911
|
-
|
21912
|
-
if (!args.no_events) {
|
21913
|
-
args = editor.fire('BeforeSetContent', args);
|
21914
|
-
if (args.isDefaultPrevented()) {
|
21915
|
-
editor.fire('SetContent', args);
|
21932
|
+
if (!contentArgs.no_events) {
|
21933
|
+
contentArgs = editor.fire('BeforeSetContent', contentArgs);
|
21934
|
+
if (contentArgs.isDefaultPrevented()) {
|
21935
|
+
editor.fire('SetContent', contentArgs);
|
21916
21936
|
return;
|
21917
21937
|
}
|
21918
21938
|
}
|
21919
|
-
content =
|
21939
|
+
content = cleanContent(editor, contentArgs);
|
21920
21940
|
if (rng.insertNode) {
|
21921
21941
|
content += '<span id="__caret">_</span>';
|
21922
21942
|
if (rng.startContainer === doc && rng.endContainer === doc) {
|
@@ -21948,19 +21968,20 @@
|
|
21948
21968
|
} catch (ex) {
|
21949
21969
|
}
|
21950
21970
|
} else {
|
21951
|
-
|
21971
|
+
var anyRng = rng;
|
21972
|
+
if (anyRng.item) {
|
21952
21973
|
doc.execCommand('Delete', false, null);
|
21953
|
-
|
21974
|
+
anyRng = editor.selection.getRng();
|
21954
21975
|
}
|
21955
21976
|
if (/^\s+/.test(content)) {
|
21956
|
-
|
21977
|
+
anyRng.pasteHTML('<span id="__mce_tmp">_</span>' + content);
|
21957
21978
|
editor.dom.remove('__mce_tmp');
|
21958
21979
|
} else {
|
21959
|
-
|
21980
|
+
anyRng.pasteHTML(content);
|
21960
21981
|
}
|
21961
21982
|
}
|
21962
|
-
if (!
|
21963
|
-
editor.fire('SetContent',
|
21983
|
+
if (!contentArgs.no_events) {
|
21984
|
+
editor.fire('SetContent', contentArgs);
|
21964
21985
|
}
|
21965
21986
|
};
|
21966
21987
|
var SetSelectionContent = { setContent: setContent };
|
@@ -22649,7 +22670,7 @@
|
|
22649
22670
|
return function () {
|
22650
22671
|
var newRng = getHorizontalRange(editor, forward);
|
22651
22672
|
if (newRng) {
|
22652
|
-
editor
|
22673
|
+
moveToRange(editor, newRng);
|
22653
22674
|
return true;
|
22654
22675
|
} else {
|
22655
22676
|
return false;
|
@@ -22660,7 +22681,7 @@
|
|
22660
22681
|
return function () {
|
22661
22682
|
var newRng = getVerticalRange(editor, down);
|
22662
22683
|
if (newRng) {
|
22663
|
-
editor
|
22684
|
+
moveToRange(editor, newRng);
|
22664
22685
|
return true;
|
22665
22686
|
} else {
|
22666
22687
|
return false;
|
@@ -22762,10 +22783,6 @@
|
|
22762
22783
|
});
|
22763
22784
|
};
|
22764
22785
|
|
22765
|
-
var moveToRange = function (editor, rng) {
|
22766
|
-
editor.selection.setRng(rng);
|
22767
|
-
ScrollIntoView.scrollRangeIntoView(editor, rng);
|
22768
|
-
};
|
22769
22786
|
var hasNextBreak = function (getPositionsUntil, scope, lineInfo) {
|
22770
22787
|
return lineInfo.breakAt.map(function (breakPos) {
|
22771
22788
|
return getPositionsUntil(scope, breakPos).breakAt.isSome();
|
@@ -26364,8 +26381,8 @@
|
|
26364
26381
|
defaultSettings: {},
|
26365
26382
|
$: DomQuery,
|
26366
26383
|
majorVersion: '4',
|
26367
|
-
minorVersion: '9.
|
26368
|
-
releaseDate: '2020-
|
26384
|
+
minorVersion: '9.11',
|
26385
|
+
releaseDate: '2020-07-13',
|
26369
26386
|
editors: legacyEditors,
|
26370
26387
|
i18n: I18n,
|
26371
26388
|
activeEditor: null,
|
@@ -24,14 +24,14 @@ module TinyMCE
|
|
24
24
|
def symlink_asset(src, dest)
|
25
25
|
with_asset(src, dest) do |src, dest|
|
26
26
|
create_symlink(src, dest)
|
27
|
-
create_symlink("#{src}.gz", "#{dest}.gz") if File.
|
27
|
+
create_symlink("#{src}.gz", "#{dest}.gz") if File.exist?("#{src}.gz")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def create_symlink(src, dest)
|
32
32
|
target = File.basename(src)
|
33
33
|
|
34
|
-
unless File.
|
34
|
+
unless File.exist?(dest) && File.symlink?(dest) && File.readlink(dest) == target
|
35
35
|
logger.info "Creating symlink #{dest}"
|
36
36
|
FileUtils.ln_s(target, dest, :force => true)
|
37
37
|
else
|
@@ -6,6 +6,7 @@ module TinyMCE
|
|
6
6
|
def self.load(manifest_path)
|
7
7
|
JsonManifest.try(manifest_path, ".sprockets-manifest*.json") ||
|
8
8
|
JsonManifest.try(manifest_path, "manifest*.json") ||
|
9
|
+
JsonManifest.try(manifest_path) ||
|
9
10
|
YamlManifest.try(manifest_path) ||
|
10
11
|
NullManifest.new
|
11
12
|
end
|
@@ -37,7 +38,7 @@ module TinyMCE
|
|
37
38
|
class YamlManifest < AssetManifest
|
38
39
|
def self.try(manifest_path)
|
39
40
|
yaml_file = File.join(manifest_path, "manifest.yml")
|
40
|
-
new(yaml_file) if File.
|
41
|
+
new(yaml_file) if File.exist?(yaml_file)
|
41
42
|
end
|
42
43
|
|
43
44
|
def initialize(file)
|
@@ -75,9 +76,13 @@ module TinyMCE
|
|
75
76
|
end
|
76
77
|
|
77
78
|
class JsonManifest < AssetManifest
|
78
|
-
def self.try(manifest_path, pattern)
|
79
|
-
|
80
|
-
|
79
|
+
def self.try(manifest_path, pattern=nil)
|
80
|
+
if pattern
|
81
|
+
paths = Dir[File.join(manifest_path, pattern)]
|
82
|
+
new(paths.first) if paths.any?
|
83
|
+
elsif File.file?(manifest_path)
|
84
|
+
new(manifest_path)
|
85
|
+
end
|
81
86
|
end
|
82
87
|
|
83
88
|
def initialize(file)
|
@@ -14,7 +14,7 @@ module TinyMCE::Rails
|
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
17
|
-
FUNCTION_REGEX = /^function\s*\(/
|
17
|
+
FUNCTION_REGEX = /^function\s*\(([\w\d\s_,]*)\)\s*\{([^}]*)\}|\(([\w\d\s_,]*)\)\s*=>\s*\{([^}]*)\}/
|
18
18
|
RELATIVE_PATH_REGEX = /^(\/|\.{1,2})\S*/
|
19
19
|
|
20
20
|
COMMA = ",".freeze
|
@@ -47,7 +47,7 @@ module TinyMCE::Rails
|
|
47
47
|
# Check for files provided in the content_css option to replace them with their actual path.
|
48
48
|
# If no corresponding stylesheet is found for a file, it will remain unchanged.
|
49
49
|
"content_css" => ->(value) {
|
50
|
-
helpers = ActionView::Base.new(ActionView::LookupContext.new([]))
|
50
|
+
helpers = ActionView::Base.new(ActionView::LookupContext.new([]), {}, nil)
|
51
51
|
separator = OPTION_SEPARATORS["content_css"]
|
52
52
|
|
53
53
|
value.split(separator).map { |file|
|
@@ -25,13 +25,13 @@ module TinyMCE::Rails
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def last_updated
|
28
|
-
File.
|
28
|
+
File.exist?(path) && File.mtime(path)
|
29
29
|
end
|
30
30
|
|
31
31
|
def load_configuration
|
32
32
|
@last_loaded = last_updated
|
33
33
|
|
34
|
-
return Configuration.new_with_defaults if !File.
|
34
|
+
return Configuration.new_with_defaults if !File.exist?(path)
|
35
35
|
|
36
36
|
options = load_yaml(path)
|
37
37
|
|
@@ -43,7 +43,8 @@ module TinyMCE::Rails
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def load_yaml(path)
|
46
|
-
|
46
|
+
result = ERB.new(IO.read(path)).result
|
47
|
+
YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(result) : YAML.load(result)
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|