Last active
August 29, 2015 13:56
-
-
Save darylteo/9223886 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <div class="datagrid_hack"></div> | |
| <script> | |
| (function ($) { | |
| // check so that this code only fires once. | |
| if ($._datagridHack) { | |
| return; | |
| } | |
| $._datagridHack = function () { | |
| var root = $('.datagrid_hack'); | |
| root.parent().parent().hide(); // hide control | |
| // only fire if the edit dialog box is open | |
| var dialog = root.parents('.ui-dialog:visible'); | |
| if (dialog.length == 0) { | |
| return; | |
| } | |
| // force the dimensions of that dialog box | |
| dialog.css({ | |
| width: 740 | |
| }).offset({ | |
| left: 0, | |
| top: 100 | |
| }) | |
| // then initialise tinyMCE on textboxes (might be better if it was more targeted) | |
| tinyMCE.init({ | |
| mode: 'textareas', | |
| theme: 'advanced', | |
| width: '700', | |
| height: '500', | |
| relative_urls: false, // urls get mangled by tinyMCE defaults. | |
| // just adding some plugins that I needed. Check tinyMCE v3 documentation. | |
| plugins: "table", | |
| theme_advanced_buttons3_add: "tablecontrols", | |
| }); | |
| }; | |
| var register = function () { | |
| // only call our function once dom and script is ready | |
| $(function () { | |
| $._datagridHack(); | |
| }) | |
| } | |
| // check if tinyMCE lib is loaded, else force load it with jQuery. | |
| if (typeof(tinyMCE) !== 'undefined') { | |
| register(); | |
| } else { | |
| var url = '/umbraco/plugins/tinymce3/tinymce3tinymceCompress.aspx?rnd=12345&module=gzipmodule&themes=umbraco&plugins=contextmenu,umbracomacro,umbracoembed,noneditable,inlinepopups,table,advlink,spellchecker,paste,umbracoimg,umbracocss,umbracopaste,umbracolink,umbracocontextmenu&languages=en'; | |
| $.getScript(url, register); | |
| } | |
| })(jQuery); | |
| </script> |
Author
Author
Added a check to see if TinyMCE is loaded (it is loaded if another data item has Richtext Editor, but if there isn't then Umbraco doesn't load it).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage