Sha256: 1ee0c79a1eae09fa4fd567f5f65d6fc23b8697281b0d2cfbf4e7fb6684f2054b
Contents?: true
Size: 2 KB
Versions: 9
Compression:
Stored size: 2 KB
Contents
(function() { if (this.RedactorPlugins == null) { this.RedactorPlugins = {}; } RedactorPlugins.scrivito_editors_link_manager = function() { var self; return self = { init: function() { this.modal.addTemplate('scrivito_link_manager_browse', self.browseButtonHtml); this.modal.addTemplate('scrivito_link_manager_url', '/$id'); this.modal.addCallback('imageEdit', self.addBrowseToModal); return this.modal.addCallback('link', self.addBrowseToModal); }, browseButtonHtml: "<button class=\"editing-button editing-green\">\n <i class=\"editing-icon editing-icon-search\"></i>\n Browse\n</button>", urlInput: function() { return this.modal.getModal().find('#redactor-link-url, #redactor-image-link'); }, addBrowseToModal: function() { return self.urlInput().wrap('<div id="scrivito-link-manager-url"></div>').after(this.modal.getTemplate('scrivito_link_manager_browse')).siblings('button').on('click', self.browse); }, browse: function() { return scrivito.content_browser.open({ filter: this.$element.data('scrivitoEditorsFilter'), filter_context: this.$element.data('scrivitoEditorsFilterContext'), selection: self.getObjIds(), selection_mode: 'single' }).done((function(_this) { return function(selection) { var id; id = selection[0]; if (id != null) { return self.setObjId(id); } }; })(this)); }, getObjIds: function() { var matches; matches = self.urlInput().val().match(/[\/:]([a-f0-9]{16})\b/); if (matches != null) { return [matches[1]]; } else { return []; } }, setObjId: function(id) { return self.urlInput().val(self.toUrl(id)); }, toUrl: function(id) { return this.modal.getTemplate('scrivito_link_manager_url').replace("$id", id); } }; }; }).call(this);
Version data entries
9 entries across 9 versions & 1 rubygems