Skip to content

Commit

Permalink
Merge pull request #47 from netgen/fixes-#42-ezoe-fix
Browse files Browse the repository at this point in the history
Fixed #42 make ezoe plugin work when no ngrm field present
  • Loading branch information
iherak authored Feb 25, 2019
2 parents 092b0fc + 9c46981 commit e120837
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
var translateString = function(key) {
var t = NgRemoteMediaTranslations[key];
if(t){return t;}
console.warn('Unregistered translation: ', key);
//console.warn('Unregistered translation: ', key);
return key;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
(function(tinymce) {
function initializeEditor(){
NgRemoteMediaTranslations = window.NgRemoteMediaTranslations || {};

var View = NgRemoteMedia.views.EzOE;
RemoteMediaSettings = window.RemoteMediaSettings || {
'ez_contentobject_id': eZOeGlobalSettings.ez_contentobject_id,
'ez_contentobject_version': eZOeGlobalSettings.ez_contentobject_version,
'url_prefix': eZOeGlobalSettings.ez_extension_url.replace('/ezoe', '')
};

var loadRemoteMedia = function(){
var View = NgRemoteMedia.views.EzOE;

var textarea = this.getElement();
var element = '.block';
var loadRemoteMedia = function(){

var options = {
textEl: textarea,
el: $(textarea).closest(element),
tinymceEditor: this
};
var textarea = this.getElement();
var element = '.block';

var options = {
textEl: textarea,
el: $(textarea).closest(element),
tinymceEditor: this
};

new View(options);
};
new View(options);
};

tinymce.create('tinymce.plugins.RemotemediaPlugin', {
init: function(ed) {
tinymce.create('tinymce.plugins.RemotemediaPlugin', {
init: function(ed) {

// Register commands
ed.addCommand('mceRemotemedia', loadRemoteMedia);
// Register commands
ed.addCommand('mceRemotemedia', loadRemoteMedia);

// Register buttons
ed.addButton('ngremotemedia', { title: 'NgRemoteMedia', cmd: 'mceRemotemedia' });
// Register buttons
ed.addButton('ngremotemedia', { title: 'NgRemoteMedia', cmd: 'mceRemotemedia' });

},
},

getInfo: function() {
return {
longname: 'NgRemoteMedia',
author: 'Netgen',
authorurl: 'http://www.netgenlabs.com',
infourl: 'http://www.netgenlabs.com',
version: tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
getInfo: function() {
return {
longname: 'NgRemoteMedia',
author: 'Netgen',
authorurl: 'http://www.netgenlabs.com',
infourl: 'http://www.netgenlabs.com',
version: tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});

// Register plugin
tinymce.PluginManager.add('ngremotemedia', tinymce.plugins.RemotemediaPlugin);
// Register plugin
tinymce.PluginManager.add('ngremotemedia', tinymce.plugins.RemotemediaPlugin);
}

setTimeout(initializeEditor, 0);
})(tinymce);

0 comments on commit e120837

Please sign in to comment.