UNPKG

apostrophe

Version:

Apostrophe is a user-friendly content management system. This core module of Apostrophe provides rich content editing and essential facilities to integrate Apostrophe into your Express project. Apostrophe also includes simple facilities for storing your r

54 lines (43 loc) 1.31 kB
/* global rangy, $, _ */ /* global alert, prompt, AposWidgetEditor, apos */ function AposPullquoteWidgetEditor(options) { var self = this; self.pullquote = '“”'; if (!options.messages) { options.messages = {}; } if (!options.messages.missing) { options.messages.missing = 'Type in a pullquote first.'; } self.type = 'pullquote'; options.template = '.apos-pullquote-editor'; // Parent class constructor shared by all widget editors AposWidgetEditor.call(self, options); self.afterCreatingEl = function() { if (self.exists) { self.pullquote = self.$widget.find('.apos-pullquote-text').text(); } self.$pullquote = self.$el.find('.apos-embed'); self.$pullquote.val(self.pullquote); setTimeout(function() { self.$pullquote.focus(); self.$pullquote.setSelection(1, 1); }, 500); // Automatically preview if we detect something that looks like a // fresh paste var last = ''; self.timers.push(setInterval(function() { var next = self.$pullquote.val(); self.exists = (next.length > 2); if (next !== last) { self.preview(); } last = next; }, 500)); }; self.getContent = function() { return self.$pullquote.val(); }; } AposPullquoteWidgetEditor.label = 'Pullquote';