-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from netgen/fixes-#42-ezoe-fix
Fixed #42 make ezoe plugin work when no ngrm field present
- Loading branch information
Showing
2 changed files
with
41 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 40 additions & 30 deletions
70
...sh_legacy/ngremotemedia/design/standard/javascript/plugins/ngremotemedia/editor_plugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |