Skip to content

Commit e0186ac

Browse files
committed
Use CKEditor's setData to properly load in protected tags, use CKEditor's getData to properly save protected tag data, load Materialize from CDN to fix Popup issues, upgrade Bower deps
1 parent cd24527 commit e0186ac

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

Diff for: bower.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
"components"
88
],
99
"dependencies": {
10-
"riot": "~2.3.18",
10+
"riot": "~3.0.7",
1111
"q": "~1.3.0",
1212
"qajax": "[email protected]:cb-talent-development/qajax#master",
1313
"underscore": "~1.8.3",
14-
"materialize": "~0.97.6",
14+
"materialize": "~0.97.8",
1515
"normalize-scss": "~3.0"
1616
},
1717
"resolutions": {

Diff for: src/app/main.js

+27-25
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
1-
(function(global) {
1+
(function (global) {
22
'use strict';
33

4-
$(function() {
4+
$(function () {
55
var body = $('body'),
66
head = $('head');
77

8-
body.prepend( $('<toolbar></toolbar>') );
9-
body.append( $('<media-library></media-library>') );
8+
body.prepend($('<toolbar></toolbar>'));
9+
body.append($('<media-library></media-library>'));
1010

11-
head.append( $('<link rel="stylesheet" type="text/css" />').attr('href', 'https://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100') );
12-
head.append( $('<link rel="stylesheet" type="text/css" />').attr('href', 'https://fonts.googleapis.com/icon?family=Material+Icons') );
13-
head.append( $('<link rel="stylesheet" type="text/css" />').attr('href', config.CONTENT_SNIPPETS_EDIT_CSS_URL) );
11+
head.append($('<link rel="stylesheet" type="text/css" />').attr('href', 'https://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100'));
12+
head.append($('<link rel="stylesheet" type="text/css" />').attr('href', 'https://fonts.googleapis.com/icon?family=Material+Icons'));
13+
head.append($('<link rel="stylesheet" type="text/css" />').attr('href', config.CONTENT_SNIPPETS_EDIT_CSS_URL));
1414

15-
$.getScript('https://cdn.ckeditor.com/4.6.2/standard/ckeditor.js', function() {
16-
global.CKEDITOR.plugins.addExternal( 'media-selector', global.config.CKEDITOR_PLUGINS_URL + 'media-selector/', 'plugin.js' );
17-
global.CKEDITOR.plugins.addExternal( 'sourcedialog', global.config.CKEDITOR_PLUGINS_URL + 'sourcedialog/', 'plugin.js' );
18-
global.CKEDITOR.plugins.addExternal( 'codemirror', global.config.CKEDITOR_PLUGINS_URL + 'codemirror/', 'plugin.js' );
15+
$.getScript('https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.min.js', function () {
16+
$.getScript('https://cdn.ckeditor.com/4.6.2/standard/ckeditor.js', function () {
17+
global.CKEDITOR.plugins.addExternal('media-selector', global.config.CKEDITOR_PLUGINS_URL + 'media-selector/', 'plugin.js');
18+
global.CKEDITOR.plugins.addExternal('sourcedialog', global.config.CKEDITOR_PLUGINS_URL + 'sourcedialog/', 'plugin.js');
19+
global.CKEDITOR.plugins.addExternal('codemirror', global.config.CKEDITOR_PLUGINS_URL + 'codemirror/', 'plugin.js');
1920

20-
global.CKEDITOR.config.allowedContent = true;
21-
global.CKEDITOR.config.extraPlugins = 'media-selector,sourcedialog';
22-
global.CKEDITOR.config.removePlugins = 'image,sourcearea';
21+
global.CKEDITOR.config.allowedContent = true;
22+
global.CKEDITOR.config.extraPlugins = 'media-selector,sourcedialog';
23+
global.CKEDITOR.config.removePlugins = 'image,sourcearea';
2324

24-
var stores = {
25-
WebpageStore: new WebpageStore(),
26-
MediasStore: new MediasStore()
27-
};
25+
var stores = {
26+
WebpageStore: new WebpageStore(),
27+
MediasStore: new MediasStore()
28+
};
2829

29-
_.each(stores, function(store) {
30-
RiotControl.addStore(store);
31-
});
30+
_.each(stores, function (store) {
31+
RiotControl.addStore(store);
32+
});
3233

33-
global.stores = stores;
34+
global.stores = stores;
3435

35-
riot.mount('snippet');
36-
riot.mount('media-library');
37-
riot.mount('toolbar');
36+
riot.mount('snippet');
37+
riot.mount('media-library');
38+
riot.mount('toolbar');
39+
});
3840
});
3941
});
4042
}(this));

Diff for: src/app/tags/snippet.tag

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
return obj.document.name == opts.id;
1111
});
1212
if (typeof foundSnippet != "undefined") {
13-
self.getElementsByClassName('editor')[0].innerHTML = foundSnippet.document.body;
14-
self.update();
13+
CKEDITOR.instances[opts.id].setData(foundSnippet.document.body);
1514
}
1615
});
1716

1817
this.contentChanged = function(event) {
19-
var body = CKEDITOR.instances[event.target.id].getData();
18+
var body = CKEDITOR.instances[opts.id].getData();
2019
RiotControl.trigger(constants.ACTIONS.SNIPPET_CHANGED, {name: opts.id, body: body});
2120
}
2221
</script>

0 commit comments

Comments
 (0)