Initial ethoFS Integration
21
assets/dashboard/plugins/tinymce/bower.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "tinymce",
|
||||
"description": "Web based JavaScript HTML WYSIWYG editor control.",
|
||||
"license": "LGPL-2.1",
|
||||
"keywords": [
|
||||
"editor",
|
||||
"wysiwyg",
|
||||
"tinymce",
|
||||
"richtext",
|
||||
"javascript",
|
||||
"html"
|
||||
],
|
||||
"homepage": "http://www.tinymce.com",
|
||||
"ignore": [
|
||||
"readme.md",
|
||||
"composer.json",
|
||||
"package.json",
|
||||
".npmignore",
|
||||
"changelog.txt"
|
||||
]
|
||||
}
|
||||
479
assets/dashboard/plugins/tinymce/changelog.txt
Normal file
@@ -0,0 +1,479 @@
|
||||
Version 4.4.1 (2016-07-26)
|
||||
Added smart_paste option to paste plugin to allow disabling the paste behavior if needed.
|
||||
Fixed bug where png urls wasn't properly detected by the smart paste logic.
|
||||
Fixed bug where the element path wasn't working properly when multiple editor instances where used.
|
||||
Fixed bug with creating lists out of multiple paragraphs would just create one list item instead of multiple.
|
||||
Fixed bug where scroll position wasn't properly handled by the inlite theme to place the toolbar properly.
|
||||
Fixed bug where multiple instances of the editor using the inlite theme didn't render the toolbar properly.
|
||||
Fixed bug where the shortcut label for fullscreen mode didn't match the actual shortcut key.
|
||||
Fixed bug where it wasn't possible to select cE=false blocks using touch devices on for example iOS.
|
||||
Fixed bug where it was possible to select the child image within a cE=false on IE 11.
|
||||
Fixed so inserts of html containing lists doesn't merge with any existing lists unless it's a paste operation.
|
||||
Version 4.4.0 (2016-06-30)
|
||||
Added new inlite theme this is a more lightweight inline UI.
|
||||
Added smarter paste logic that auto detects urls in the clipboard and inserts images/links based on that.
|
||||
Added a better image resize algorithm for better image quality in the imagetools plugin.
|
||||
Fixed bug where it wasn't possible to drag/dropping cE=false elements on FF.
|
||||
Fixed bug where backspace/delete before/after a cE=false block would produce a new paragraph.
|
||||
Fixed bug where list style type css property wasn't preserved when indenting lists.
|
||||
Fixed bug where merging of lists where done even if the list style type was different.
|
||||
Fixed bug where the image_dataimg_filter function wasn't used when pasting images.
|
||||
Fixed bug where nested editable within a non editable element would cause scroll on focus in Chrome.
|
||||
Fixed so invalid targets for inline mode is blocked on initialization. We only support elements that can have children.
|
||||
Version 4.3.13 (2016-06-08)
|
||||
Added characters with a diacritical mark to charmap plugin. Patch contributed by Dominik Schilling.
|
||||
Added better error handling if the image proxy service would produce errors.
|
||||
Fixed issue with pasting list items into list items would produce nested list rather than a merged list.
|
||||
Fixed bug where table selection could get stuck in selection mode for inline editors.
|
||||
Fixed bug where it was possible to place the caret inside the resize grid elements.
|
||||
Fixed bug where it wasn't possible to place in elements horizontally adjacent cE=false blocks.
|
||||
Fixed bug where multiple notifications wouldn't be properly placed on screen.
|
||||
Fixed bug where multiple editor instance of the same id could be produces in some specific integrations.
|
||||
Version 4.3.12 (2016-05-10)
|
||||
Fixed bug where focus calls couldn't be made inside the editors PostRender event handler.
|
||||
Fixed bug where some translations wouldn't work as expected due to a bug in editor.translate.
|
||||
Fixed bug where the node change event could fire with a node out side the root of the editor.
|
||||
Fixed bug where Chrome wouldn't properly present the keyboard paste clipboard details when paste was clicked.
|
||||
Fixed bug where merged cells in tables couldn't be selected from right to left.
|
||||
Fixed bug where insert row wouldn't properly update a merged cells rowspan property.
|
||||
Fixed bug where the color input boxes preview field wasn't properly set on initialization.
|
||||
Fixed bug where IME composition inside table cells wouldn't work as expected on IE 11.
|
||||
Fixed so all shadow dom support is under and experimental flag due to flaky browser support.
|
||||
Version 4.3.11 (2016-04-25)
|
||||
Fixed bug where it wasn't possible to insert empty blocks though the API unless they where padded.
|
||||
Fixed bug where you couldn't type the Euro character on Windows.
|
||||
Fixed bug where backspace/delete from a cE=false element to a text block didn't work properly.
|
||||
Fixed bug where the text color default grid would render incorrectly.
|
||||
Fixed bug where the codesample plugin wouldn't load the css in the editor for multiple editors.
|
||||
Fixed so the codesample plugin textarea gets focused by default.
|
||||
Version 4.3.10 (2016-04-12)
|
||||
Fixed bug where the key "y" on WebKit couldn't be entered due to conflict with keycode for F10 on keypress.
|
||||
Version 4.3.9 (2016-04-12)
|
||||
Added support for focusing the contextual toolbars using keyboard.
|
||||
Added keyboard support for slider UI controls. You can no increase/decrease using arrow keys.
|
||||
Added url pattern matching for Dailymotion to media plugin. Patch contributed by Bertrand Darbon.
|
||||
Added body_class to template plugin preview. Patch contributed by Milen Petrinski.
|
||||
Added options to better override textcolor pickers with custom colors. Patch contributed by Xavier Boubert.
|
||||
Added visual arrows to inline contextual toolbars so that they point to the element being active.
|
||||
Fixed so toolbars for tables or other larger elements get better positioned below the scrollable viewport.
|
||||
Fixed bug where it was possible to click links inside cE=false blocks.
|
||||
Fixed bug where event targets wasn't properly handled in Safari Technical Preview.
|
||||
Fixed bug where drag/drop text in FF 45 would make the editor caret invisible.
|
||||
Fixed bug where the remove state wasn't properly set on editor instances when detected as clobbered.
|
||||
Fixed bug where offscreen selection of some cE=false elements would render onscreen. Patch contributed by Steven Bufton
|
||||
Fixed bug where enter would clone styles out side the root on editors inside a span. Patch contributed by ChristophKaser.
|
||||
Fixed bug where drag/drop of images into the editor didn't work correctly in FF.
|
||||
Fixed so the first item in panels for the imagetools dialog gets proper keyboard focus.
|
||||
Changed the Meta+Shift+F shortcut to Ctrl+Shift+F since Czech, Slovak, Polish languages used the first one for input.
|
||||
Version 4.3.8 (2016-03-15)
|
||||
Fixed bug where inserting HR at the end of a block element would produce an extra empty block.
|
||||
Fixed bug where links would be clickable when readonly mode was enabled.
|
||||
Fixed bug where the formatter would normalize to the wrong node on very specific content.
|
||||
Fixed bug where some nested list items couldn't be indented properly.
|
||||
Fixed bug where links where clickable in the preview dialog.
|
||||
Fixed so the alt attribute doesn't get padded with an empty value by default.
|
||||
Fixed so nested alignment works more correctly. You will now alter the alignment to the closest block parent.
|
||||
Version 4.3.7 (2016-03-02)
|
||||
Fixed bug where incorrect icons would be rendered for imagetools edit and color levels.
|
||||
Fixed bug where navigation using arrow keys inside a SelectBox didn't move up/down.
|
||||
Fixed bug where the visualblocks plugin would render borders round internal UI elements.
|
||||
Version 4.3.6 (2016-03-01)
|
||||
Added new paste_remember_plaintext_info option to allow a global disable of the plain text mode notification.
|
||||
Added new PastePlainTextToggle event that fires when plain text mode toggles on/off.
|
||||
Fixed bug where it wasn't possible to select media elements since the drag logic would snap it to mouse cursor.
|
||||
Fixed bug where it was hard to place the caret inside nested cE=true elements when the outer cE=false element was focused.
|
||||
Fixed bug where editors wouldn't properly initialize if both selector and mode where used.
|
||||
Fixed bug where IME input inside table cells would switch the IME off.
|
||||
Fixed bug where selection inside the first table cell would cause the whole table cell to get selected.
|
||||
Fixed bug where error handling of images being uploaded wouldn't properly handle faulty statuses.
|
||||
Fixed bug where inserting contents before a HR would cause an exception to be thrown.
|
||||
Fixed bug where copy/paste of Excel data would be inserted as an image.
|
||||
Fixed caret position issues with copy/paste of inline block cE=false elements.
|
||||
Fixed issues with various menu item focus bugs in Chrome. Where the focused menu bar item wasn't properly blurred.
|
||||
Fixed so the notifications have a solid background since it would be hard to read if there where text under it.
|
||||
Fixed so notifications gets animated similar to the ones used by dialogs.
|
||||
Fixed so larger images that gets pasted is handled better.
|
||||
Fixed so the window close button is more uniform on various platform and also increased it's hit area.
|
||||
Version 4.3.5 (2016-02-11)
|
||||
Npm version bump due to package not being fully updated.
|
||||
Version 4.3.4 (2016-02-11)
|
||||
Added new OpenWindow/CloseWindow events that gets fired when windows open/close.
|
||||
Added new NewCell/NewRow events that gets fired when table cells/rows are created.
|
||||
Added new Promise return value to tinymce.init makes it easier to handle initialization.
|
||||
Removed the jQuery version the jQuery plugin is now moved into the main package.
|
||||
Removed jscs from build process since eslint can now handle code style checking.
|
||||
Fixed various bugs with drag/drop of contentEditable:false elements.
|
||||
Fixed bug where deleting of very specific nested list items would result in an odd list.
|
||||
Fixed bug where lists would get merged with adjacent lists outside the editable inline root.
|
||||
Fixed bug where MS Edge would crash when closing a dialog then clicking a menu item.
|
||||
Fixed bug where table cell selection would add undo levels.
|
||||
Fixed bug where table cell selection wasn't removed when inline editor where removed.
|
||||
Fixed bug where table cell selection wouldn't work properly on nested tables.
|
||||
Fixed bug where table merge menu would be available when merging between thead and tbody.
|
||||
Fixed bug where table row/column resize wouldn't get properly removed when the editor was removed.
|
||||
Fixed bug where Chrome would scroll to the editor if there where a empty hash value in document url.
|
||||
Fixed bug where the cache suffix wouldn't work correctly with the importcss plugin.
|
||||
Fixed bug where selection wouldn't work properly on MS Edge on Windows Phone 10.
|
||||
Fixed so adjacent pre blocks gets joined into one pre block since that seems like the user intent.
|
||||
Fixed so events gets properly dispatched in shadow dom. Patch provided by Nazar Mokrynskyi.
|
||||
Version 4.3.3 (2016-01-14)
|
||||
Added new table_resize_bars configuration setting. This setting allows you to disable the table resize bars.
|
||||
Added new beforeInitialize event to tinymce.util.XHR lets you modify XHR properties before open. Patch contributed by Brent Clintel.
|
||||
Added new autolink_pattern setting to autolink plugin. Enables you to override the default autolink formats. Patch contributed by Ben Tiedt.
|
||||
Added new charmap option that lets you override the default charmap of the charmap plugin.
|
||||
Added new charmap_append option that lets you add new characters to the default charmap of the charmap plugin.
|
||||
Added new insertCustomChar event that gets fired when a character is inserted by the charmap plugin.
|
||||
Fixed bug where table cells started with a superfluous in IE10+.
|
||||
Fixed bug where table plugin would retain all BR tags when cells were merged.
|
||||
Fixed bug where media plugin would strip underscores from youtube urls.
|
||||
Fixed bug where IME input would fail on IE 11 if you typed within a table.
|
||||
Fixed bug where double click selection of a word would remove the space before the word on insert contents.
|
||||
Fixed bug where table plugin would produce exceptions when hovering tables with invalid structure.
|
||||
Fixed bug where fullscreen wouldn't scroll back to it's original position when untoggled.
|
||||
Fixed so the template plugins templates setting can be a function that gets a callback that can provide templates.
|
||||
Version 4.3.2 (2015-12-14)
|
||||
Fixed bug where the resize bars for table cells were not affected by the object_resizing property.
|
||||
Fixed bug where the contextual table toolbar would appear incorrectly if TinyMCE was initialized inline inside a table.
|
||||
Fixed bug where resizing table cells did not fire a node change event or add an undo level.
|
||||
Fixed bug where double click selection of text on IE 11 wouldn't work properly.
|
||||
Fixed bug where codesample plugin would incorrectly produce br elements inside code elements.
|
||||
Fixed bug where media plugin would strip dashes from youtube urls.
|
||||
Fixed bug where it was possible to move the caret into the table resize bars.
|
||||
Fixed bug where drag/drop into a cE=false element was possible on IE.
|
||||
Version 4.3.1 (2015-11-30)
|
||||
Fixed so it's possible to disable the table inline toolbar by setting it to false or an empty string.
|
||||
Fixed bug where it wasn't possible to resize some tables using the drag handles.
|
||||
Fixed bug where unique id:s would clash for multiple editor instances and cE=false selections.
|
||||
Fixed bug where the same plugin could be initialized multiple times.
|
||||
Fixed bug where the table inline toolbars would be displayed at the same time as the image toolbars.
|
||||
Fixed bug where the table selection rect wouldn't be removed when selecting another control element.
|
||||
Version 4.3.0 (2015-11-23)
|
||||
Added new table column/row resize support. Makes it a lot more easy to resize the columns/rows in a table.
|
||||
Added new table inline toolbar. Makes it easier to for example add new rows or columns to a table.
|
||||
Added new notification API. Lets you display floating notifications to the end user.
|
||||
Added new codesample plugin that lets you insert syntax highlighted pre elements into the editor.
|
||||
Added new image_caption to images. Lets you create images with captions using a HTML5 figure/figcaption elements.
|
||||
Added new live previews of embeded videos. Lets you play the video right inside the editor.
|
||||
Added new setDirty method and "dirty" event to the editor. Makes it easier to track the dirty state change.
|
||||
Added new setMode method to Editor instances that lets you dynamically switch between design/readonly.
|
||||
Added new core support for contentEditable=false elements within the editor overrides the browsers broken behavior.
|
||||
Rewrote the noneditable plugin to use the new contentEditable false core logic.
|
||||
Fixed so the dirty state doesn't set set to false automatically when the undo index is set to 0.
|
||||
Fixed the Selection.placeCaretAt so it works better on IE when the coordinate is between paragraphs.
|
||||
Fixed bug where data-mce-bogus="all" element contents where counted by the word count plugin.
|
||||
Fixed bug where contentEditable=false elements would be indented by the indent buttons.
|
||||
Fixed bug where images within contentEditable=false would be selected in WebKit on mouse click.
|
||||
Fixed bug in DOMUntils split method where the replacement parameter wouldn't work on specific cases.
|
||||
Fixed bug where the importcss plugin would import classes from the skin content css file.
|
||||
Fixed so all button variants have a wrapping span for it's text to make it easier to skin.
|
||||
Fixed so it's easier to exit pre block using the arrow keys.
|
||||
Fixed bug where listboxes with fix widths didn't render correctly.
|
||||
Version 4.2.8 (2015-11-13)
|
||||
Fixed bug where it was possible to delete tables as the inline root element if all columns where selected.
|
||||
Fixed bug where the UI buttons active state wasn't properly updated due to recent refactoring of that logic.
|
||||
Version 4.2.7 (2015-10-27)
|
||||
Fixed bug where backspace/delete would remove all formats on the last paragraph character in WebKit/Blink.
|
||||
Fixed bug where backspace within a inline format element with a bogus caret container would move the caret.
|
||||
Fixed bug where backspace/delete on selected table cells wouldn't add an undo level.
|
||||
Fixed bug where script tags embedded within the editor could sometimes get a mce- prefix prepended to them
|
||||
Fixed bug where validate: false option could produce an error to be thrown from the Serialization step.
|
||||
Fixed bug where inline editing of a table as the root element could let the user delete that table.
|
||||
Fixed bug where inline editing of a table as the root element wouldn't properly handle enter key.
|
||||
Fixed bug where inline editing of a table as the root element would normalize the selection incorrectly.
|
||||
Fixed bug where inline editing of a list as the root element could let the user delete that list.
|
||||
Fixed bug where inline editing of a list as the root element could let the user split that list.
|
||||
Fixed bug where resize handles would be rendered on editable root elements such as table.
|
||||
Version 4.2.6 (2015-09-28)
|
||||
Added capability to set request headers when using XHRs.
|
||||
Added capability to upload local images automatically default delay is set to 30 seconds after editing images.
|
||||
Added commands ids mceEditImage, mceAchor and mceMedia to be avaiable from execCommand.
|
||||
Added Edge browser to saucelabs grunt task. Patch contributed by John-David Dalton.
|
||||
Fixed bug where blob uris not produced by tinymce would produce HTML invalid markup.
|
||||
Fixed bug where selection of contents of a nearly empty editor in Edge would sometimes fail.
|
||||
Fixed bug where color styles woudln't be retained on copy/paste in Blink/Webkit.
|
||||
Fixed bug where the table plugin would throw an error when inserting rows after a child table.
|
||||
Fixed bug where the template plugin wouldn't handle functions as variable replacements.
|
||||
Fixed bug where undo/redo sometimes wouldn't work properly when applying formatting collapsed ranges.
|
||||
Fixed bug where shift+delete wouldn't do a cut operation on Blink/WebKit.
|
||||
Fixed bug where cut action wouldn't properly store the before selection bookmark for the undo level.
|
||||
Fixed bug where backspace in side an empty list element on IE would loose editor focus.
|
||||
Fixed bug where the save plugin wouldn't enable the buttons when a change occurred.
|
||||
Fixed bug where Edge wouldn't initialize the editor if a document.domain was specified.
|
||||
Fixed bug where enter key before nested images would sometimes not properly expand the previous block.
|
||||
Fixed bug where the inline toolbars wouldn't get properly hidden when blurring the editor instance.
|
||||
Fixed bug where Edge would paste Chinese characters on some Windows 10 installations.
|
||||
Fixed bug where IME would loose focus on IE 11 due to the double trailing br bug fix.
|
||||
Fixed bug where the proxy url in imagetools was incorrect. Patch contributed by Wong Ho Wang.
|
||||
Version 4.2.5 (2015-08-31)
|
||||
Added fullscreen capability to embedded youtube and vimeo videos.
|
||||
Fixed bug where the uploadImages call didn't work on IE 10.
|
||||
Fixed bug where image place holders would be uploaded by uploadImages call.
|
||||
Fixed bug where images marked with bogus would be uploaded by the uploadImages call.
|
||||
Fixed bug where multiple calls to uploadImages would result in decreased performance.
|
||||
Fixed bug where pagebreaks were editable to imagetools patch contributed by Rasmus Wallin.
|
||||
Fixed bug where the element path could cause too much recursion exception.
|
||||
Fixed bug for domains containing ".min". Patch contributed by Loïc Février.
|
||||
Fixed so validation of external links to accept a number after www. Patch contributed by Victor Carvalho.
|
||||
Fixed so the charmap is exposed though execCommand. Patch contributed by Matthew Will.
|
||||
Fixed so that the image uploads are concurrent for improved performance.
|
||||
Fixed various grammar problems in inline documentation. Patches provided by nikolas.
|
||||
Version 4.2.4 (2015-08-17)
|
||||
Added picture as a valid element to the HTML 5 schema. Patch contributed by Adam Taylor.
|
||||
Fixed bug where contents would be duplicated on drag/drop within the same editor.
|
||||
Fixed bug where floating/alignment of images on Edge wouldn't work properly.
|
||||
Fixed bug where it wasn't possible to drag images on IE 11.
|
||||
Fixed bug where image selection on Edge would sometimes fail.
|
||||
Fixed bug where contextual toolbars icons wasn't rendered properly when using the toolbar_items_size.
|
||||
Fixed bug where searchreplace dialog doesn't get prefilled with the selected text.
|
||||
Fixed bug where fragmented matches wouldn't get properly replaced by the searchreplace plugin.
|
||||
Fixed bug where enter key wouldn't place the caret if was after a trailing space within an inline element.
|
||||
Fixed bug where the autolink plugin could produce multiple links for the same text on Gecko.
|
||||
Fixed bug where EditorUpload could sometimes throw an exception if the blob wasn't found.
|
||||
Fixed xss issues with media plugin not properly filtering out some script attributes.
|
||||
Version 4.2.3 (2015-07-30)
|
||||
Fixed bug where image selection wasn't possible on Edge due to incompatible setBaseAndExtend API.
|
||||
Fixed bug where image blobs urls where not properly destroyed by the imagetools plugin.
|
||||
Fixed bug where keyboard shortcuts wasn't working correctly on IE 8.
|
||||
Fixed skin issue where the borders of panels where not visible on IE 8.
|
||||
Version 4.2.2 (2015-07-22)
|
||||
Fixed bug where float panels were not being hidden on inline editor blur when fixed_toolbar_container config option was in use.
|
||||
Fixed bug where combobox states wasn't properly updated if contents where updated without keyboard.
|
||||
Fixed bug where pasting into textbox or combobox would move the caret to the end of text.
|
||||
Fixed bug where removal of bogus span elements before block elements would remove whitespace between nodes.
|
||||
Fixed bug where repositioning of inline toolbars where async and producing errors if the editor was removed from DOM to early. Patch by iseulde.
|
||||
Fixed bug where element path wasn't working correctly. Patch contributed by iseulde.
|
||||
Fixed bug where menus wasn't rendered correctly when custom images where added to a menu. Patch contributed by Naim Hammadi.
|
||||
Version 4.2.1 (2015-06-29)
|
||||
Fixed bug where back/forward buttons in the browser would render blob images as broken images.
|
||||
Fixed bug where Firefox would throw regexp to big error when replacing huge base64 chunks.
|
||||
Fixed bug rendering issues with resize and context toolbars not being placed properly until next animation frame.
|
||||
Fixed bug where the rendering of the image while cropping would some times not be centered correctly.
|
||||
Fixed bug where listbox items with submenus would me selected as active.
|
||||
Fixed bug where context menu where throwing an error when rendering.
|
||||
Fixed bug where resize both option wasn't working due to resent addClass API change. Patch contributed by Jogai.
|
||||
Fixed bug where a hideAll call for container rendered inline toolbars would throw an error.
|
||||
Fixed bug where onclick event handler on combobox could cause issues if element.id was a function by some polluting libraries.
|
||||
Fixed bug where listboxes wouldn't get proper selected sub menu item when using link_list or image_list.
|
||||
Fixed so the UI controls are as wide as 4.1.x to avoid wrapping controls in toolbars.
|
||||
Fixed so the imagetools dialog is adaptive for smaller screen sizes.
|
||||
Version 4.2.0 (2015-06-25)
|
||||
Added new flat default skin to make the UI more modern.
|
||||
Added new imagetools plugin, lets you crop/resize and apply filters to images.
|
||||
Added new contextual toolbars support to the API lets you add floating toolbars for specific CSS selectors.
|
||||
Added new promise feature fill as tinymce.util.Promise.
|
||||
Added new built in image upload feature lets you upload any base64 encoded image within the editor as files.
|
||||
Fixed bug where resize handles would appear in the right position in the wrong editor when switching between resizable content in different inline editors.
|
||||
Fixed bug where tables would not be inserted in inline mode due to previous float panel fix.
|
||||
Fixed bug where floating panels would remain open when focus was lost on inline editors.
|
||||
Fixed bug where cut command on Chrome would thrown a browser security exception.
|
||||
Fixed bug where IE 11 sometimes would report an incorrect size for images in the image dialog.
|
||||
Fixed bug where it wasn't possible to remove inline formatting at the end of block elements.
|
||||
Fixed bug where it wasn't possible to delete table cell contents when cell selection was vertical.
|
||||
Fixed bug where table cell wasn't emptied from block elements if delete/backspace where pressed in empty cell.
|
||||
Fixed bug where cmd+shift+arrow didn't work correctly on Firefox mac when selecting to start/end of line.
|
||||
Fixed bug where removal of bogus elements would sometimes remove whitespace between nodes.
|
||||
Fixed bug where the resize handles wasn't updated when the main window was resized.
|
||||
Fixed so script elements gets removed by default to prevent possible XSS issues in default config implementations.
|
||||
Fixed so the UI doesn't need manual reflows when using non native layout managers.
|
||||
Fixed so base64 encoded images doesn't slow down the editor on modern browsers while editing.
|
||||
Fixed so all UI elements uses touch events to improve mobile device support.
|
||||
Removed the touch click quirks patch for iOS since it did more harm than good.
|
||||
Removed the non proportional resize handles since. Unproportional resize can still be done by holding the shift key.
|
||||
Version 4.1.10 (2015-05-05)
|
||||
Fixed bug where plugins loaded with compat3x would sometimes throw errors when loading using the jQuery version.
|
||||
Fixed bug where extra empty paragraphs would get deleted in WebKit/Blink due to recent Quriks fix.
|
||||
Fixed bug where the editor wouldn't work properly on IE 12 due to some required browser sniffing.
|
||||
Fixed bug where formatting shortcut keys where interfering with Mac OS X screenshot keys.
|
||||
Fixed bug where the caret wouldn't move to the next/previous line boundary on Cmd+Left/Right on Gecko.
|
||||
Fixed bug where it wasn't possible to remove formats from very specific nested contents.
|
||||
Fixed bug where undo levels wasn't produced when typing letters using the shift or alt+ctrl modifiers.
|
||||
Fixed bug where the dirty state wasn't properly updated when typing using the shift or alt+ctrl modifiers.
|
||||
Fixed bug where an error would be thrown if an autofocused editor was destroyed quickly after its initialization. Patch provided by thorn0.
|
||||
Fixed issue with dirty state not being properly updated on redo operation.
|
||||
Fixed issue with entity decoder not handling incorrectly written numeric entities.
|
||||
Fixed issue where some PI element values wouldn't be properly encoded.
|
||||
Version 4.1.9 (2015-03-10)
|
||||
Fixed bug where indentation wouldn't work properly for non list elements.
|
||||
Fixed bug with image plugin not pulling the image dimensions out correctly if a custom document_base_url was used.
|
||||
Fixed bug where ctrl+alt+[1-9] would conflict with the AltGr+[1-9] on Windows. New shortcuts is ctrl+shift+[1-9].
|
||||
Fixed bug with removing formatting on nodes in inline mode would sometimes include nodes outside the editor body.
|
||||
Fixed bug where extra nbsp:s would be inserted when you replaced a word surrounded by spaces using insertContent.
|
||||
Fixed bug with pasting from Google Docs would produce extra strong elements and line feeds.
|
||||
Version 4.1.8 (2015-03-05)
|
||||
Added new html5 sizes attribute to img elements used together with srcset.
|
||||
Added new elementpath option that makes it possible to disable the element path but keep the statusbar.
|
||||
Added new option table_style_by_css for the table plugin to set table styling with css rather than table attributes.
|
||||
Added new link_assume_external_targets option to prompt the user to prepend http:// prefix if the supplied link does not contain a protocol prefix.
|
||||
Added new image_prepend_url option to allow a custom base path/url to be added to images.
|
||||
Added new table_appearance_options option to make it possible to disable some options.
|
||||
Added new image_title option to make it possible to alter the title of the image, disabled by default.
|
||||
Fixed bug where selection starting from out side of the body wouldn't produce a proper selection range on IE 11.
|
||||
Fixed bug where pressing enter twice before a table moves the cursor in the table and causes a javascript error.
|
||||
Fixed bug where advanced image styles were not respected.
|
||||
Fixed bug where the less common Shift+Delete didn't produce a proper cut operation on WebKit browsers.
|
||||
Fixed bug where image/media size constrain logic would produce NaN when handling non number values.
|
||||
Fixed bug where internal classes where removed by the removeformat command.
|
||||
Fixed bug with creating links table cell contents with a specific selection would throw a exceptions on WebKit/Blink.
|
||||
Fixed bug where valid_classes option didn't work as expected according to docs. Patch provided by thorn0.
|
||||
Fixed bug where jQuery plugin would patch the internal methods multiple times. Patch provided by Drew Martin.
|
||||
Fixed bug where backspace key wouldn't delete the current selection of newly formatted content.
|
||||
Fixed bug where type over of inline formatting elements wouldn't properly keep the format on WebKit/Blink.
|
||||
Fixed bug where selection needed to be properly normalized on modern IE versions.
|
||||
Fixed bug where Command+Backspace didn't properly delete the whole line of text but the previous word.
|
||||
Fixed bug where UI active states wheren't properly updated on IE if you placed caret within the current range.
|
||||
Fixed bug where delete/backspace on WebKit/Blink would remove span elements created by the user.
|
||||
Fixed bug where delete/backspace would produce incorrect results when deleting between two text blocks with br elements.
|
||||
Fixed bug where captions where removed when pasting from MS Office.
|
||||
Fixed bug where lists plugin wouldn't properly remove fully selected nested lists.
|
||||
Fixed bug where the ttf font used for icons would throw an warning message on Gecko on Mac OS X.
|
||||
Fixed a bug where applying a color to text did not update the undo/redo history.
|
||||
Fixed so shy entities gets displayed when using the visualchars plugin.
|
||||
Fixed so removeformat removes ins/del by default since these might be used for strikethough.
|
||||
Fixed so multiple language packs can be loaded and added to the global I18n data structure.
|
||||
Fixed so transparent color selection gets treated as a normal color selection. Patch contributed by Alexander Hofbauer.
|
||||
Fixed so it's possible to disable autoresize_overflow_padding, autoresize_bottom_margin options by setting them to false.
|
||||
Fixed so the charmap plugin shows the description of the character in the dialog. Patch contributed by Jelle Hissink.
|
||||
Removed address from the default list of block formats since it tends to be missused.
|
||||
Fixed so the pre block format is called preformatted to make it more verbose.
|
||||
Fixed so it's possible to context scope translation strings this isn't needed most of the time.
|
||||
Fixed so the max length of the width/height input fields of the media dialog is 5 instead of 3.
|
||||
Fixed so drag/dropped contents gets properly processed by paste plugin since it's basically a paste. Patch contributed by Greg Fairbanks.
|
||||
Fixed so shortcut keys for headers is ctrl+alt+[1-9] instead of ctrl+[1-9] since these are for switching tabs in the browsers.
|
||||
Fixed so "u" doesn't get converted into a span element by the legacy input filter. Since this is now a valid HTML5 element.
|
||||
Fixed font families in order to provide appropriate web-safe fonts.
|
||||
Version 4.1.7 (2014-11-27)
|
||||
Added HTML5 schema support for srcset, source and picture. Patch contributed by mattheu.
|
||||
Added new cache_suffix setting to enable cache busting by producing unique urls.
|
||||
Added new paste_convert_word_fake_lists option to enable users to disable the fake lists convert logic.
|
||||
Fixed so advlist style changes adds undo levels for each change.
|
||||
Fixed bug where WebKit would sometimes produce an exception when the autolink plugin where looking for URLs.
|
||||
Fixed bug where IE 7 wouldn't be rendered properly due to to aggressive css compression.
|
||||
Fixed bug where DomQuery wouldn't accept window as constructor element.
|
||||
Fixed bug where the color picker in 3.x dialogs wouldn't work properly. Patch contributed by Callidior.
|
||||
Fixed bug where the image plugin wouldn't respect the document_base_url.
|
||||
Fixed bug where the jQuery plugin would fail to append to elements named array prototype names.
|
||||
Version 4.1.6 (2014-10-08)
|
||||
Fixed bug with clicking on the scrollbar of the iframe would cause a JS error to be thrown.
|
||||
Fixed bug where null would produce an exception if you passed it to selection.setRng.
|
||||
Fixed bug where Ctrl/Cmd+Tab would indent the current list item if you switched tabs in the browser.
|
||||
Fixed bug where pasting empty cells from Excel would result in a broken table.
|
||||
Fixed bug where it wasn't possible to switch back to default list style type.
|
||||
Fixed issue where the select all quirk fix would fire for other modifiers than Ctrl/Cmd combinations.
|
||||
Replaced jake with grunt since it is more mainstream and has better plugin support.
|
||||
Version 4.1.5 (2014-09-09)
|
||||
Fixed bug where sometimes the resize rectangles wouldn't properly render on images on WebKit/Blink.
|
||||
Fixed bug in list plugin where delete/backspace would merge empty LI elements in lists incorrectly.
|
||||
Fixed bug where empty list elements would result in empty LI elements without it's parent container.
|
||||
Fixed bug where backspace in empty caret formatted element could produce an type error exception of Gecko.
|
||||
Fixed bug where lists pasted from word with a custom start index above 9 wouldn't be properly handled.
|
||||
Fixed bug where tabfocus plugin would tab out of the editor instance even if the default action was prevented.
|
||||
Fixed bug where tabfocus wouldn't tab properly to other adjacent editor instances.
|
||||
Fixed bug where the DOMUtils setStyles wouldn't properly removed or update the data-mce-style attribute.
|
||||
Fixed bug where dialog select boxes would be placed incorrectly if document.body wasn't statically positioned.
|
||||
Fixed bug where pasting would sometimes scroll to the top of page if the user was using the autoresize plugin.
|
||||
Fixed bug where caret wouldn't be properly rendered by Chrome when clicking on the iframes documentElement.
|
||||
Fixed so custom images for menubutton/splitbutton can be provided. Patch contributed by Naim Hammadi.
|
||||
Fixed so the default action of windows closing can be prevented by blocking the default action of the close event.
|
||||
Fixed so nodeChange and focus of the editor isn't automatically performed when opening sub dialogs.
|
||||
Version 4.1.4 (2014-08-21)
|
||||
Added new media_filter_html option to media plugin that blocks any conditional comments, scripts etc within a video element.
|
||||
Added new content_security_policy option allows you to set custom policy for iframe contents. Patch contributed by Francois Chagnon.
|
||||
Fixed bug where activate/deactivate events wasn't firing properly when switching between editors.
|
||||
Fixed bug where placing the caret on iOS was difficult due to a WebKit bug with touch events.
|
||||
Fixed bug where the resize helper wouldn't render properly on older IE versions.
|
||||
Fixed bug where resizing images inside tables on older IE versions would sometimes fail depending mouse position.
|
||||
Fixed bug where editor.insertContent would produce an exception when inserting select/option elements.
|
||||
Fixed bug where extra empty paragraphs would be produced if block elements where inserted inside span elements.
|
||||
Fixed bug where the spellchecker menu item wouldn't be properly checked if spell checking was started before it was rendered.
|
||||
Fixed bug where the DomQuery filter function wouldn't remove non elements from collection.
|
||||
Fixed bug where document with custom document.domain wouldn't properly render the editor.
|
||||
Fixed bug where IE 8 would throw exception when trying to enter invalid color values into colorboxes.
|
||||
Fixed bug where undo manager could incorrectly add an extra undo level when custom resize handles was removed.
|
||||
Fixed bug where it wouldn't be possible to alter cell properties properly on table cells on IE 8.
|
||||
Fixed so the color picker button in table dialog isn't shown unless you include the colorpicker plugin or add your own custom color picker.
|
||||
Fixed so activate/deactivate events fire when windowManager opens a window since.
|
||||
Fixed so the table advtab options isn't separated by an underscore to normalize naming with image_advtab option.
|
||||
Fixed so the table cell dialog has proper padding when the advanced tab in disabled.
|
||||
Version 4.1.3 (2014-07-29)
|
||||
Added event binding logic to tinymce.util.XHR making it possible to override headers and settings before any request is made.
|
||||
Fixed bug where drag events wasn't fireing properly on older IE versions since the event handlers where bound to document.
|
||||
Fixed bug where drag/dropping contents within the editor on IE would force the contents into plain text mode even if it was internal content.
|
||||
Fixed bug where IE 7 wouldn't open menus properly due to a resize bug in the browser auto closing them immediately.
|
||||
Fixed bug where the DOMUtils getPos logic wouldn't produce a valid coordinate inside the body if the body was positioned non static.
|
||||
Fixed bug where the element path and format state wasn't properly updated if you had the wordcount plugin enabled.
|
||||
Fixed bug where a comment at the beginning of source would produce an exception in the formatter logic.
|
||||
Fixed bug where setAttrib/getAttrib on null would throw exception together with any hooked attributes like style.
|
||||
Fixed bug where table sizes wasn't properly retained when copy/pasting on WebKit/Blink.
|
||||
Fixed bug where WebKit/Blink would produce colors in RGB format instead of the forced HEX format when deleting contents.
|
||||
Fixed bug where the width attribute wasn't updated on tables if you changed the size inside the table dialog.
|
||||
Fixed bug where control selection wasn't properly handled when the caret was placed directly after an image.
|
||||
Fixed bug where selecting the contents of table cells using the selection.select method wouldn't place the caret properly.
|
||||
Fixed bug where the selection state for images wasn't removed when placing the caret right after an image on WebKit/Blink.
|
||||
Fixed bug where all events wasn't properly unbound when and editor instance was removed or destroyed by some external innerHTML call.
|
||||
Fixed bug where it wasn't possible or very hard to select images on iOS when the onscreen keyboard was visible.
|
||||
Fixed so auto_focus can take a boolean argument this will auto focus the last initialized editor might be useful for single inits.
|
||||
Fixed so word auto detect lists logic works better for faked lists that doesn't have specific markup.
|
||||
Fixed so nodeChange gets fired on mouseup as it used to before 4.1.1 we optimized that event to fire less often.
|
||||
Removed the finish menu item from spellchecker menu since it's redundant you can stop spellchecking by toggling menu item or button.
|
||||
Version 4.1.2 (2014-07-15)
|
||||
Added offset/grep to DomQuery class works basically the same as it's jQuery equivalent.
|
||||
Fixed bug where backspace/delete or setContent with an empty string would remove header data when using the fullpage plugin.
|
||||
Fixed bug where tinymce.remove with a selector not matching any editors would remove all editors.
|
||||
Fixed bug where resizing of the editor didn't work since the theme was calling setStyles instead of setStyle.
|
||||
Fixed bug where IE 7 would fail to append html fragments to iframe document when using DomQuery.
|
||||
Fixed bug where the getStyle DOMUtils method would produce an exception if it was called with null as it's element.
|
||||
Fixed bug where the paste plugin would remove the element if the none of the paste_webkit_styles rules matched the current style.
|
||||
Fixed bug where contextmenu table items wouldn't work properly on IE since it would some times fire an incorrect selection change.
|
||||
Fixed bug where the padding/border values wasn't used in the size calculation for the body size when using autoresize. Patch contributed by Matt Whelan.
|
||||
Fixed bug where conditional word comments wouldn't be properly removed when pasting plain text.
|
||||
Fixed bug where resizing would sometime fail on IE 11 when the mouseup occurred inside the resizable element.
|
||||
Fixed so the iframe gets initialized without any inline event handlers for better CSP support. Patch contributed by Matt Whelan.
|
||||
Fixed so the tinymce.dom.Sizzle is the latest version of sizzle this resolves the document context bug.
|
||||
Version 4.1.1 (2014-07-08)
|
||||
Fixed bug where pasting plain text on some WebKit versions would result in an empty line.
|
||||
Fixed bug where resizing images inside tables on IE 11 wouldn't work properly.
|
||||
Fixed bug where IE 11 would sometimes throw "Invalid argument" exception when editor contents was set to an empty string.
|
||||
Fixed bug where document.activeElement would throw exceptions on IE 9 when that element was hidden or removed from dom.
|
||||
Fixed bug where WebKit/Blink sometimes produced br elements with the Apple-interchange-newline class.
|
||||
Fixed bug where table cell selection wasn't properly removed when copy/pasting table cells.
|
||||
Fixed bug where pasting nested list items from Word wouldn't produce proper semantic nested lists.
|
||||
Fixed bug where right clicking using the contextmenu plugin on WebKit/Blink on Mac OS X would select the target current word or line.
|
||||
Fixed bug where it wasn't possible to alter table cell properties on IE 8 using the context menu.
|
||||
Fixed bug where the resize helper wouldn't be correctly positioned on older IE versions.
|
||||
Fixed bug where fullpage plugin would produce an error if you didn't specify a doctype encoding.
|
||||
Fixed bug where anchor plugin would get the name/id of the current element even if it wasn't anchor element.
|
||||
Fixed bug where visual aids for tables wouldn't be properly disabled when changing the border size.
|
||||
Fixed bug where some control selection events wasn't properly fired on older IE versions.
|
||||
Fixed bug where table cell selection on older IE versions would prevent resizing of images.
|
||||
Fixed bug with paste_data_images paste option not working properly on modern IE versions.
|
||||
Fixed bug where custom elements with underscores in the name wasn't properly parsed/serialized.
|
||||
Fixed bug where applying inline formats to nested list elements would produce an incorrect formatting result.
|
||||
Fixed so it's possible to hide items from elements path by using preventDefault/stopPropagation.
|
||||
Fixed so inline mode toolbar gets rendered right aligned if the editable element positioned to the documents right edge.
|
||||
Fixed so empty inline elements inside empty block elements doesn't get removed if configured to be kept intact.
|
||||
Fixed so DomQuery parentsUntil/prevUntil/nextUntil supports selectors/elements/filters etc.
|
||||
Fixed so legacyoutput plugin overrides fontselect and fontsizeselect controls and handles font elements properly.
|
||||
Version 4.1.0 (2014-06-18)
|
||||
Added new file_picker_callback option to replace the old file_browser_callback the latter will still work though.
|
||||
Added new custom colors to textcolor plugin will be displayed if a color picker is provided also shows the latest colors.
|
||||
Added new color_picker_callback option to enable you to add custom color pickers to the editor.
|
||||
Added new advanced tabs to table/cell/row dialogs to enable you to select colors for border/background.
|
||||
Added new colorpicker plugin that lets you select colors from a hsv color picker.
|
||||
Added new tinymce.util.Color class to handle color parsing and converting.
|
||||
Added new colorpicker UI widget element lets you add a hsv color picker to any form/window.
|
||||
Added new textpattern plugin that allows you to use markdown like text patterns to format contents.
|
||||
Added new resize helper element that shows the current width & height while resizing.
|
||||
Added new "once" method to Editor and EventDispatcher enables since callback execution events.
|
||||
Added new jQuery like class under tinymce.dom.DomQuery it's exposed on editor instances (editor.$) and globally under (tinymce.$).
|
||||
Fixed so the default resize method for images are proportional shift/ctrl can be used to make an unproportional size.
|
||||
Fixed bug where the image_dimensions option of the image plugin would cause exceptions when it tried to update the size.
|
||||
Fixed bug where table cell dialog class field wasn't properly updated when editing an a table cell with an existing class.
|
||||
Fixed bug where Safari on Mac would produce webkit-fake-url for pasted images so these are now removed.
|
||||
Fixed bug where the nodeChange event would get fired before the selection was changed when clicking inside the current selection range.
|
||||
Fixed bug where valid_classes option would cause exception when it removed internal prefixed classes like mce-item-.
|
||||
Fixed bug where backspace would cause navigation in IE 8 on an inline element and after a caret formatting was applied.
|
||||
Fixed so placeholder images produced by the media plugin gets selected when inserted/edited.
|
||||
Fixed so it's possible to drag in images when the paste_data_images option is enabled. Might be useful for mail clients.
|
||||
Fixed so images doesn't get a width/height applied if the image_dimensions option is set to false useful for responsive contents.
|
||||
Fixed so it's possible to pass in an optional arguments object for the nodeChanged function to be passed to all nodechange event listeners.
|
||||
Fixed bug where media plugin embed code didn't update correctly.
|
||||
42
assets/dashboard/plugins/tinymce/composer.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "tinymce/tinymce",
|
||||
"version": "4.4.1",
|
||||
"description": "Web based JavaScript HTML WYSIWYG editor control.",
|
||||
"license": [
|
||||
"LGPL-2.1"
|
||||
],
|
||||
"keywords": [
|
||||
"editor",
|
||||
"wysiwyg",
|
||||
"tinymce",
|
||||
"richtext",
|
||||
"javascript",
|
||||
"html"
|
||||
],
|
||||
"homepage": "http://www.tinymce.com",
|
||||
"type": "component",
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"tinymce.js",
|
||||
"plugins/*/plugin.js",
|
||||
"themes/*/theme.js"
|
||||
],
|
||||
"files": [
|
||||
"tinymce.min.js",
|
||||
"plugins/*/plugin.min.js",
|
||||
"themes/*/theme.min.js",
|
||||
"skins/**"
|
||||
]
|
||||
}
|
||||
},
|
||||
"archive": {
|
||||
"exclude": [
|
||||
"readme.md",
|
||||
"bower.js",
|
||||
"package.json",
|
||||
".npmignore",
|
||||
"changelog.txt"
|
||||
]
|
||||
}
|
||||
}
|
||||
377
assets/dashboard/plugins/tinymce/jquery.tinymce.js
Normal file
@@ -0,0 +1,377 @@
|
||||
/**
|
||||
* jquery.tinymce.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true, jQuery */
|
||||
|
||||
(function($) {
|
||||
var undef,
|
||||
lazyLoading,
|
||||
patchApplied,
|
||||
delayedInits = [],
|
||||
win = window;
|
||||
|
||||
$.fn.tinymce = function(settings) {
|
||||
var self = this, url, base, lang, suffix = "";
|
||||
|
||||
// No match then just ignore the call
|
||||
if (!self.length) {
|
||||
return self;
|
||||
}
|
||||
|
||||
// Get editor instance
|
||||
if (!settings) {
|
||||
return window.tinymce ? tinymce.get(self[0].id) : null;
|
||||
}
|
||||
|
||||
self.css('visibility', 'hidden'); // Hide textarea to avoid flicker
|
||||
|
||||
function init() {
|
||||
var editors = [], initCount = 0;
|
||||
|
||||
// Apply patches to the jQuery object, only once
|
||||
if (!patchApplied) {
|
||||
applyPatch();
|
||||
patchApplied = true;
|
||||
}
|
||||
|
||||
// Create an editor instance for each matched node
|
||||
self.each(function(i, node) {
|
||||
var ed, id = node.id, oninit = settings.oninit;
|
||||
|
||||
// Generate unique id for target element if needed
|
||||
if (!id) {
|
||||
node.id = id = tinymce.DOM.uniqueId();
|
||||
}
|
||||
|
||||
// Only init the editor once
|
||||
if (tinymce.get(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create editor instance and render it
|
||||
ed = new tinymce.Editor(id, settings, tinymce.EditorManager);
|
||||
editors.push(ed);
|
||||
|
||||
ed.on('init', function() {
|
||||
var scope, func = oninit;
|
||||
|
||||
self.css('visibility', '');
|
||||
|
||||
// Run this if the oninit setting is defined
|
||||
// this logic will fire the oninit callback ones each
|
||||
// matched editor instance is initialized
|
||||
if (oninit) {
|
||||
// Fire the oninit event ones each editor instance is initialized
|
||||
if (++initCount == editors.length) {
|
||||
if (typeof func === "string") {
|
||||
scope = (func.indexOf(".") === -1) ? null : tinymce.resolve(func.replace(/\.\w+$/, ""));
|
||||
func = tinymce.resolve(func);
|
||||
}
|
||||
|
||||
// Call the oninit function with the object
|
||||
func.apply(scope || tinymce, editors);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Render the editor instances in a separate loop since we
|
||||
// need to have the full editors array used in the onInit calls
|
||||
$.each(editors, function(i, ed) {
|
||||
ed.render();
|
||||
});
|
||||
}
|
||||
|
||||
// Load TinyMCE on demand, if we need to
|
||||
if (!win.tinymce && !lazyLoading && (url = settings.script_url)) {
|
||||
lazyLoading = 1;
|
||||
base = url.substring(0, url.lastIndexOf("/"));
|
||||
|
||||
// Check if it's a dev/src version they want to load then
|
||||
// make sure that all plugins, themes etc are loaded in source mode as well
|
||||
if (url.indexOf('.min') != -1) {
|
||||
suffix = ".min";
|
||||
}
|
||||
|
||||
// Setup tinyMCEPreInit object this will later be used by the TinyMCE
|
||||
// core script to locate other resources like CSS files, dialogs etc
|
||||
// You can also predefined a tinyMCEPreInit object and then it will use that instead
|
||||
win.tinymce = win.tinyMCEPreInit || {
|
||||
base: base,
|
||||
suffix: suffix
|
||||
};
|
||||
|
||||
// url contains gzip then we assume it's a compressor
|
||||
if (url.indexOf('gzip') != -1) {
|
||||
lang = settings.language || "en";
|
||||
url = url + (/\?/.test(url) ? '&' : '?') + "js=true&core=true&suffix=" + escape(suffix) +
|
||||
"&themes=" + escape(settings.theme || 'modern') + "&plugins=" +
|
||||
escape(settings.plugins || '') + "&languages=" + (lang || '');
|
||||
|
||||
// Check if compressor script is already loaded otherwise setup a basic one
|
||||
if (!win.tinyMCE_GZ) {
|
||||
win.tinyMCE_GZ = {
|
||||
start: function() {
|
||||
function load(url) {
|
||||
tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(url));
|
||||
}
|
||||
|
||||
// Add core languages
|
||||
load("langs/" + lang + ".js");
|
||||
|
||||
// Add themes with languages
|
||||
load("themes/" + settings.theme + "/theme" + suffix + ".js");
|
||||
load("themes/" + settings.theme + "/langs/" + lang + ".js");
|
||||
|
||||
// Add plugins with languages
|
||||
$.each(settings.plugins.split(","), function(i, name) {
|
||||
if (name) {
|
||||
load("plugins/" + name + "/plugin" + suffix + ".js");
|
||||
load("plugins/" + name + "/langs/" + lang + ".js");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
end: function() {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.onload = script.onreadystatechange = function(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (lazyLoading !== 2 && (e.type == 'load' || /complete|loaded/.test(script.readyState))) {
|
||||
tinymce.dom.Event.domLoaded = 1;
|
||||
lazyLoading = 2;
|
||||
|
||||
// Execute callback after mainscript has been loaded and before the initialization occurs
|
||||
if (settings.script_loaded) {
|
||||
settings.script_loaded();
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
$.each(delayedInits, function(i, init) {
|
||||
init();
|
||||
});
|
||||
}
|
||||
};
|
||||
script.src = url;
|
||||
document.body.appendChild(script);
|
||||
} else {
|
||||
// Delay the init call until tinymce is loaded
|
||||
if (lazyLoading === 1) {
|
||||
delayedInits.push(init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
// Add :tinymce pseudo selector this will select elements that has been converted into editor instances
|
||||
// it's now possible to use things like $('*:tinymce') to get all TinyMCE bound elements.
|
||||
$.extend($.expr[":"], {
|
||||
tinymce: function(e) {
|
||||
var editor;
|
||||
|
||||
if (e.id && "tinymce" in window) {
|
||||
editor = tinymce.get(e.id);
|
||||
|
||||
if (editor && editor.editorManager === tinymce) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// This function patches internal jQuery functions so that if
|
||||
// you for example remove an div element containing an editor it's
|
||||
// automatically destroyed by the TinyMCE API
|
||||
function applyPatch() {
|
||||
// Removes any child editor instances by looking for editor wrapper elements
|
||||
function removeEditors(name) {
|
||||
// If the function is remove
|
||||
if (name === "remove") {
|
||||
this.each(function(i, node) {
|
||||
var ed = tinyMCEInstance(node);
|
||||
|
||||
if (ed) {
|
||||
ed.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.find("span.mceEditor,div.mceEditor").each(function(i, node) {
|
||||
var ed = tinymce.get(node.id.replace(/_parent$/, ""));
|
||||
|
||||
if (ed) {
|
||||
ed.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Loads or saves contents from/to textarea if the value
|
||||
// argument is defined it will set the TinyMCE internal contents
|
||||
function loadOrSave(value) {
|
||||
var self = this, ed;
|
||||
|
||||
// Handle set value
|
||||
/*jshint eqnull:true */
|
||||
if (value != null) {
|
||||
removeEditors.call(self);
|
||||
|
||||
// Saves the contents before get/set value of textarea/div
|
||||
self.each(function(i, node) {
|
||||
var ed;
|
||||
|
||||
if ((ed = tinymce.get(node.id))) {
|
||||
ed.setContent(value);
|
||||
}
|
||||
});
|
||||
} else if (self.length > 0) {
|
||||
// Handle get value
|
||||
if ((ed = tinymce.get(self[0].id))) {
|
||||
return ed.getContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns tinymce instance for the specified element or null if it wasn't found
|
||||
function tinyMCEInstance(element) {
|
||||
var ed = null;
|
||||
|
||||
if (element && element.id && win.tinymce) {
|
||||
ed = tinymce.get(element.id);
|
||||
}
|
||||
|
||||
return ed;
|
||||
}
|
||||
|
||||
// Checks if the specified set contains tinymce instances
|
||||
function containsTinyMCE(matchedSet) {
|
||||
return !!((matchedSet) && (matchedSet.length) && (win.tinymce) && (matchedSet.is(":tinymce")));
|
||||
}
|
||||
|
||||
// Patch various jQuery functions
|
||||
var jQueryFn = {};
|
||||
|
||||
// Patch some setter/getter functions these will
|
||||
// now be able to set/get the contents of editor instances for
|
||||
// example $('#editorid').html('Content'); will update the TinyMCE iframe instance
|
||||
$.each(["text", "html", "val"], function(i, name) {
|
||||
var origFn = jQueryFn[name] = $.fn[name],
|
||||
textProc = (name === "text");
|
||||
|
||||
$.fn[name] = function(value) {
|
||||
var self = this;
|
||||
|
||||
if (!containsTinyMCE(self)) {
|
||||
return origFn.apply(self, arguments);
|
||||
}
|
||||
|
||||
if (value !== undef) {
|
||||
loadOrSave.call(self.filter(":tinymce"), value);
|
||||
origFn.apply(self.not(":tinymce"), arguments);
|
||||
|
||||
return self; // return original set for chaining
|
||||
}
|
||||
|
||||
var ret = "";
|
||||
var args = arguments;
|
||||
|
||||
(textProc ? self : self.eq(0)).each(function(i, node) {
|
||||
var ed = tinyMCEInstance(node);
|
||||
|
||||
if (ed) {
|
||||
ret += textProc ? ed.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g, "") : ed.getContent({save: true});
|
||||
} else {
|
||||
ret += origFn.apply($(node), args);
|
||||
}
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
});
|
||||
|
||||
// Makes it possible to use $('#id').append("content"); to append contents to the TinyMCE editor iframe
|
||||
$.each(["append", "prepend"], function(i, name) {
|
||||
var origFn = jQueryFn[name] = $.fn[name],
|
||||
prepend = (name === "prepend");
|
||||
|
||||
$.fn[name] = function(value) {
|
||||
var self = this;
|
||||
|
||||
if (!containsTinyMCE(self)) {
|
||||
return origFn.apply(self, arguments);
|
||||
}
|
||||
|
||||
if (value !== undef) {
|
||||
if (typeof value === "string") {
|
||||
self.filter(":tinymce").each(function(i, node) {
|
||||
var ed = tinyMCEInstance(node);
|
||||
|
||||
if (ed) {
|
||||
ed.setContent(prepend ? value + ed.getContent() : ed.getContent() + value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
origFn.apply(self.not(":tinymce"), arguments);
|
||||
|
||||
return self; // return original set for chaining
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// Makes sure that the editor instance gets properly destroyed when the parent element is removed
|
||||
$.each(["remove", "replaceWith", "replaceAll", "empty"], function(i, name) {
|
||||
var origFn = jQueryFn[name] = $.fn[name];
|
||||
|
||||
$.fn[name] = function() {
|
||||
removeEditors.call(this, name);
|
||||
|
||||
return origFn.apply(this, arguments);
|
||||
};
|
||||
});
|
||||
|
||||
jQueryFn.attr = $.fn.attr;
|
||||
|
||||
// Makes sure that $('#tinymce_id').attr('value') gets the editors current HTML contents
|
||||
$.fn.attr = function(name, value) {
|
||||
var self = this, args = arguments;
|
||||
|
||||
if ((!name) || (name !== "value") || (!containsTinyMCE(self))) {
|
||||
if (value !== undef) {
|
||||
return jQueryFn.attr.apply(self, args);
|
||||
}
|
||||
|
||||
return jQueryFn.attr.apply(self, args);
|
||||
}
|
||||
|
||||
if (value !== undef) {
|
||||
loadOrSave.call(self.filter(":tinymce"), value);
|
||||
jQueryFn.attr.apply(self.not(":tinymce"), args);
|
||||
|
||||
return self; // return original set for chaining
|
||||
}
|
||||
|
||||
var node = self[0], ed = tinyMCEInstance(node);
|
||||
|
||||
return ed ? ed.getContent({save: true}) : jQueryFn.attr.apply($(node), args);
|
||||
};
|
||||
}
|
||||
})(jQuery);
|
||||
1
assets/dashboard/plugins/tinymce/jquery.tinymce.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(a){function b(){function b(a){"remove"===a&&this.each(function(a,b){var c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var d;(d=tinymce.get(c.id))&&d.setContent(a)});else if(d.length>0&&(c=tinymce.get(d[0].id)))return c.getContent()}function e(a){var b=null;return a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(b,g){var i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return f(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var i=this,j=arguments;if(!b||"value"!==b||!f(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var i,j,k,l=this,m="";if(!l.length)return l;if(!c)return window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return l},a.extend(a.expr[":"],{tinymce:function(a){var b;return!!(a.id&&"tinymce"in window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce))}})}(jQuery);
|
||||
504
assets/dashboard/plugins/tinymce/license.txt
Normal file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
47
assets/dashboard/plugins/tinymce/package.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "tinymce",
|
||||
"version": "4.4.1",
|
||||
"description": "Web based JavaScript HTML WYSIWYG editor control.",
|
||||
"license": "LGPL-2.1",
|
||||
"keywords": [
|
||||
"editor",
|
||||
"wysiwyg",
|
||||
"tinymce",
|
||||
"richtext",
|
||||
"javascript",
|
||||
"html"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "http://www.tinymce.com/develop/bugtracker.php"
|
||||
},
|
||||
"_id": "tinymce@4.4.1",
|
||||
"scripts": {},
|
||||
"_shasum": "c39037add71b0ae4226e29bf7d55be1f92435dcd",
|
||||
"_from": "tinymce@4.4.1",
|
||||
"_resolved": "https://registry.npmjs.org/tinymce/-/tinymce-4.4.1.tgz",
|
||||
"_npmVersion": "3.8.6",
|
||||
"_nodeVersion": "5.11.1",
|
||||
"_npmUser": {
|
||||
"name": "ephox",
|
||||
"email": "is-accounts@ephox.com"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "c39037add71b0ae4226e29bf7d55be1f92435dcd",
|
||||
"tarball": "https://registry.npmjs.org/tinymce/-/tinymce-4.4.1.tgz"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "ephox",
|
||||
"email": "is-accounts@ephox.com"
|
||||
},
|
||||
{
|
||||
"name": "spocke",
|
||||
"email": "spocke@moxiecode.com"
|
||||
}
|
||||
],
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/tinymce-4.4.1.tgz_1469527487002_0.7330783300567418"
|
||||
},
|
||||
"directories": {}
|
||||
}
|
||||
101
assets/dashboard/plugins/tinymce/plugins/advlist/plugin.js
Normal file
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('advlist', function(editor) {
|
||||
var olMenuItems, ulMenuItems, lastStyles = {};
|
||||
|
||||
function buildMenuItems(listName, styleValues) {
|
||||
var items = [];
|
||||
|
||||
tinymce.each(styleValues.split(/[ ,]/), function(styleValue) {
|
||||
items.push({
|
||||
text: styleValue.replace(/\-/g, ' ').replace(/\b\w/g, function(chr) {
|
||||
return chr.toUpperCase();
|
||||
}),
|
||||
data: styleValue == 'default' ? '' : styleValue
|
||||
});
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
olMenuItems = buildMenuItems('OL', editor.getParam(
|
||||
"advlist_number_styles",
|
||||
"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman"
|
||||
));
|
||||
|
||||
ulMenuItems = buildMenuItems('UL', editor.getParam("advlist_bullet_styles", "default,circle,disc,square"));
|
||||
|
||||
function applyListFormat(listName, styleValue) {
|
||||
editor.undoManager.transact(function() {
|
||||
var list, dom = editor.dom, sel = editor.selection;
|
||||
|
||||
// Check for existing list element
|
||||
list = dom.getParent(sel.getNode(), 'ol,ul');
|
||||
|
||||
// Switch/add list type if needed
|
||||
if (!list || list.nodeName != listName || styleValue === false) {
|
||||
var detail = {
|
||||
'list-style-type': styleValue ? styleValue : ''
|
||||
};
|
||||
|
||||
editor.execCommand(listName == 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList', false, detail);
|
||||
}
|
||||
|
||||
// Set style
|
||||
styleValue = styleValue === false ? lastStyles[listName] : styleValue;
|
||||
lastStyles[listName] = styleValue;
|
||||
|
||||
list = dom.getParent(sel.getNode(), 'ol,ul');
|
||||
if (list) {
|
||||
dom.setStyle(list, 'listStyleType', styleValue ? styleValue : null);
|
||||
list.removeAttribute('data-mce-style');
|
||||
}
|
||||
|
||||
editor.focus();
|
||||
});
|
||||
}
|
||||
|
||||
function updateSelection(e) {
|
||||
var listStyleType = editor.dom.getStyle(editor.dom.getParent(editor.selection.getNode(), 'ol,ul'), 'listStyleType') || '';
|
||||
|
||||
e.control.items().each(function(ctrl) {
|
||||
ctrl.active(ctrl.settings.data === listStyleType);
|
||||
});
|
||||
}
|
||||
|
||||
editor.addButton('numlist', {
|
||||
type: 'splitbutton',
|
||||
tooltip: 'Numbered list',
|
||||
menu: olMenuItems,
|
||||
onshow: updateSelection,
|
||||
onselect: function(e) {
|
||||
applyListFormat('OL', e.control.settings.data);
|
||||
},
|
||||
onclick: function() {
|
||||
applyListFormat('OL', false);
|
||||
}
|
||||
});
|
||||
|
||||
editor.addButton('bullist', {
|
||||
type: 'splitbutton',
|
||||
tooltip: 'Bullet list',
|
||||
menu: ulMenuItems,
|
||||
onshow: updateSelection,
|
||||
onselect: function(e) {
|
||||
applyListFormat('UL', e.control.settings.data);
|
||||
},
|
||||
onclick: function() {
|
||||
applyListFormat('UL', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/advlist/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("advlist",function(a){function b(a,b){var c=[];return tinymce.each(b.split(/[ ,]/),function(a){c.push({text:a.replace(/\-/g," ").replace(/\b\w/g,function(a){return a.toUpperCase()}),data:"default"==a?"":a})}),c}function c(b,c){a.undoManager.transact(function(){var d,e=a.dom,f=a.selection;if(d=e.getParent(f.getNode(),"ol,ul"),!d||d.nodeName!=b||c===!1){var h={"list-style-type":c?c:""};a.execCommand("UL"==b?"InsertUnorderedList":"InsertOrderedList",!1,h)}c=c===!1?g[b]:c,g[b]=c,d=e.getParent(f.getNode(),"ol,ul"),d&&(e.setStyle(d,"listStyleType",c?c:null),d.removeAttribute("data-mce-style")),a.focus()})}function d(b){var c=a.dom.getStyle(a.dom.getParent(a.selection.getNode(),"ol,ul"),"listStyleType")||"";b.control.items().each(function(a){a.active(a.settings.data===c)})}var e,f,g={};e=b("OL",a.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),f=b("UL",a.getParam("advlist_bullet_styles","default,circle,disc,square")),a.addButton("numlist",{type:"splitbutton",tooltip:"Numbered list",menu:e,onshow:d,onselect:function(a){c("OL",a.control.settings.data)},onclick:function(){c("OL",!1)}}),a.addButton("bullist",{type:"splitbutton",tooltip:"Bullet list",menu:f,onshow:d,onselect:function(a){c("UL",a.control.settings.data)},onclick:function(){c("UL",!1)}})});
|
||||
55
assets/dashboard/plugins/tinymce/plugins/anchor/plugin.js
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('anchor', function(editor) {
|
||||
function showDialog() {
|
||||
var selectedNode = editor.selection.getNode(), name = '';
|
||||
var isAnchor = selectedNode.tagName == 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
|
||||
|
||||
if (isAnchor) {
|
||||
name = selectedNode.name || selectedNode.id || '';
|
||||
}
|
||||
|
||||
editor.windowManager.open({
|
||||
title: 'Anchor',
|
||||
body: {type: 'textbox', name: 'name', size: 40, label: 'Name', value: name},
|
||||
onsubmit: function(e) {
|
||||
var id = e.data.name;
|
||||
|
||||
if (isAnchor) {
|
||||
selectedNode.id = id;
|
||||
} else {
|
||||
editor.selection.collapse(true);
|
||||
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
|
||||
id: id
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
editor.addCommand('mceAnchor', showDialog);
|
||||
|
||||
editor.addButton('anchor', {
|
||||
icon: 'anchor',
|
||||
tooltip: 'Anchor',
|
||||
onclick: showDialog,
|
||||
stateSelector: 'a:not([href])'
|
||||
});
|
||||
|
||||
editor.addMenuItem('anchor', {
|
||||
icon: 'anchor',
|
||||
text: 'Anchor',
|
||||
context: 'insert',
|
||||
onclick: showDialog
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/anchor/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("anchor",function(a){function b(){var b=a.selection.getNode(),c="",d="A"==b.tagName&&""===a.dom.getAttrib(b,"href");d&&(c=b.name||b.id||""),a.windowManager.open({title:"Anchor",body:{type:"textbox",name:"name",size:40,label:"Name",value:c},onsubmit:function(c){var e=c.data.name;d?b.id=e:(a.selection.collapse(!0),a.execCommand("mceInsertContent",!1,a.dom.createHTML("a",{id:e})))}})}a.addCommand("mceAnchor",b),a.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:b,stateSelector:"a:not([href])"}),a.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:b})});
|
||||
204
assets/dashboard/plugins/tinymce/plugins/autolink/plugin.js
Normal file
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('autolink', function(editor) {
|
||||
var AutoUrlDetectState;
|
||||
var AutoLinkPattern = /^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i;
|
||||
|
||||
if (editor.settings.autolink_pattern) {
|
||||
AutoLinkPattern = editor.settings.autolink_pattern;
|
||||
}
|
||||
|
||||
editor.on("keydown", function(e) {
|
||||
if (e.keyCode == 13) {
|
||||
return handleEnter(editor);
|
||||
}
|
||||
});
|
||||
|
||||
// Internet Explorer has built-in automatic linking for most cases
|
||||
if (tinymce.Env.ie) {
|
||||
editor.on("focus", function() {
|
||||
if (!AutoUrlDetectState) {
|
||||
AutoUrlDetectState = true;
|
||||
|
||||
try {
|
||||
editor.execCommand('AutoUrlDetect', false, true);
|
||||
} catch (ex) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
editor.on("keypress", function(e) {
|
||||
if (e.keyCode == 41) {
|
||||
return handleEclipse(editor);
|
||||
}
|
||||
});
|
||||
|
||||
editor.on("keyup", function(e) {
|
||||
if (e.keyCode == 32) {
|
||||
return handleSpacebar(editor);
|
||||
}
|
||||
});
|
||||
|
||||
function handleEclipse(editor) {
|
||||
parseCurrentLine(editor, -1, '(', true);
|
||||
}
|
||||
|
||||
function handleSpacebar(editor) {
|
||||
parseCurrentLine(editor, 0, '', true);
|
||||
}
|
||||
|
||||
function handleEnter(editor) {
|
||||
parseCurrentLine(editor, -1, '', false);
|
||||
}
|
||||
|
||||
function parseCurrentLine(editor, end_offset, delimiter) {
|
||||
var rng, end, start, endContainer, bookmark, text, matches, prev, len, rngText;
|
||||
|
||||
function scopeIndex(container, index) {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
if (container.nodeType == 3) {
|
||||
var len = container.data.length;
|
||||
|
||||
if (index > len) {
|
||||
index = len;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
function setStart(container, offset) {
|
||||
if (container.nodeType != 1 || container.hasChildNodes()) {
|
||||
rng.setStart(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setStartBefore(container);
|
||||
}
|
||||
}
|
||||
|
||||
function setEnd(container, offset) {
|
||||
if (container.nodeType != 1 || container.hasChildNodes()) {
|
||||
rng.setEnd(container, scopeIndex(container, offset));
|
||||
} else {
|
||||
rng.setEndAfter(container);
|
||||
}
|
||||
}
|
||||
|
||||
// Never create a link when we are inside a link
|
||||
if (editor.selection.getNode().tagName == 'A') {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need at least five characters to form a URL,
|
||||
// hence, at minimum, five characters from the beginning of the line.
|
||||
rng = editor.selection.getRng(true).cloneRange();
|
||||
if (rng.startOffset < 5) {
|
||||
// During testing, the caret is placed between two text nodes.
|
||||
// The previous text node contains the URL.
|
||||
prev = rng.endContainer.previousSibling;
|
||||
if (!prev) {
|
||||
if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {
|
||||
return;
|
||||
}
|
||||
|
||||
prev = rng.endContainer.firstChild.nextSibling;
|
||||
}
|
||||
|
||||
len = prev.length;
|
||||
setStart(prev, len);
|
||||
setEnd(prev, len);
|
||||
|
||||
if (rng.endOffset < 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
end = rng.endOffset;
|
||||
endContainer = prev;
|
||||
} else {
|
||||
endContainer = rng.endContainer;
|
||||
|
||||
// Get a text node
|
||||
if (endContainer.nodeType != 3 && endContainer.firstChild) {
|
||||
while (endContainer.nodeType != 3 && endContainer.firstChild) {
|
||||
endContainer = endContainer.firstChild;
|
||||
}
|
||||
|
||||
// Move range to text node
|
||||
if (endContainer.nodeType == 3) {
|
||||
setStart(endContainer, 0);
|
||||
setEnd(endContainer, endContainer.nodeValue.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (rng.endOffset == 1) {
|
||||
end = 2;
|
||||
} else {
|
||||
end = rng.endOffset - 1 - end_offset;
|
||||
}
|
||||
}
|
||||
|
||||
start = end;
|
||||
|
||||
do {
|
||||
// Move the selection one character backwards.
|
||||
setStart(endContainer, end >= 2 ? end - 2 : 0);
|
||||
setEnd(endContainer, end >= 1 ? end - 1 : 0);
|
||||
end -= 1;
|
||||
rngText = rng.toString();
|
||||
|
||||
// Loop until one of the following is found: a blank space, , delimiter, (end-2) >= 0
|
||||
} while (rngText != ' ' && rngText !== '' && rngText.charCodeAt(0) != 160 && (end - 2) >= 0 && rngText != delimiter);
|
||||
|
||||
if (rng.toString() == delimiter || rng.toString().charCodeAt(0) == 160) {
|
||||
setStart(endContainer, end);
|
||||
setEnd(endContainer, start);
|
||||
end += 1;
|
||||
} else if (rng.startOffset === 0) {
|
||||
setStart(endContainer, 0);
|
||||
setEnd(endContainer, start);
|
||||
} else {
|
||||
setStart(endContainer, end);
|
||||
setEnd(endContainer, start);
|
||||
}
|
||||
|
||||
// Exclude last . from word like "www.site.com."
|
||||
text = rng.toString();
|
||||
if (text.charAt(text.length - 1) == '.') {
|
||||
setEnd(endContainer, start - 1);
|
||||
}
|
||||
|
||||
text = rng.toString();
|
||||
matches = text.match(AutoLinkPattern);
|
||||
|
||||
if (matches) {
|
||||
if (matches[1] == 'www.') {
|
||||
matches[1] = 'http://www.';
|
||||
} else if (/@$/.test(matches[1]) && !/^mailto:/.test(matches[1])) {
|
||||
matches[1] = 'mailto:' + matches[1];
|
||||
}
|
||||
|
||||
bookmark = editor.selection.getBookmark();
|
||||
|
||||
editor.selection.setRng(rng);
|
||||
editor.execCommand('createlink', false, matches[1] + matches[2]);
|
||||
editor.selection.moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/autolink/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("autolink",function(a){function b(a){e(a,-1,"(",!0)}function c(a){e(a,0,"",!0)}function d(a){e(a,-1,"",!1)}function e(a,b,c){function d(a,b){if(0>b&&(b=0),3==a.nodeType){var c=a.data.length;b>c&&(b=c)}return b}function e(a,b){1!=a.nodeType||a.hasChildNodes()?h.setStart(a,d(a,b)):h.setStartBefore(a)}function f(a,b){1!=a.nodeType||a.hasChildNodes()?h.setEnd(a,d(a,b)):h.setEndAfter(a)}var h,i,j,k,l,m,n,o,p,q;if("A"!=a.selection.getNode().tagName){if(h=a.selection.getRng(!0).cloneRange(),h.startOffset<5){if(o=h.endContainer.previousSibling,!o){if(!h.endContainer.firstChild||!h.endContainer.firstChild.nextSibling)return;o=h.endContainer.firstChild.nextSibling}if(p=o.length,e(o,p),f(o,p),h.endOffset<5)return;i=h.endOffset,k=o}else{if(k=h.endContainer,3!=k.nodeType&&k.firstChild){for(;3!=k.nodeType&&k.firstChild;)k=k.firstChild;3==k.nodeType&&(e(k,0),f(k,k.nodeValue.length))}i=1==h.endOffset?2:h.endOffset-1-b}j=i;do e(k,i>=2?i-2:0),f(k,i>=1?i-1:0),i-=1,q=h.toString();while(" "!=q&&""!==q&&160!=q.charCodeAt(0)&&i-2>=0&&q!=c);h.toString()==c||160==h.toString().charCodeAt(0)?(e(k,i),f(k,j),i+=1):0===h.startOffset?(e(k,0),f(k,j)):(e(k,i),f(k,j)),m=h.toString(),"."==m.charAt(m.length-1)&&f(k,j-1),m=h.toString(),n=m.match(g),n&&("www."==n[1]?n[1]="http://www.":/@$/.test(n[1])&&!/^mailto:/.test(n[1])&&(n[1]="mailto:"+n[1]),l=a.selection.getBookmark(),a.selection.setRng(h),a.execCommand("createlink",!1,n[1]+n[2]),a.selection.moveToBookmark(l),a.nodeChanged())}}var f,g=/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i;return a.settings.autolink_pattern&&(g=a.settings.autolink_pattern),a.on("keydown",function(b){return 13==b.keyCode?d(a):void 0}),tinymce.Env.ie?void a.on("focus",function(){if(!f){f=!0;try{a.execCommand("AutoUrlDetect",!1,!0)}catch(b){}}}):(a.on("keypress",function(c){return 41==c.keyCode?b(a):void 0}),void a.on("keyup",function(b){return 32==b.keyCode?c(a):void 0}))});
|
||||
162
assets/dashboard/plugins/tinymce/plugins/autoresize/plugin.js
Normal file
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
/*eslint no-nested-ternary:0 */
|
||||
|
||||
/**
|
||||
* Auto Resize
|
||||
*
|
||||
* This plugin automatically resizes the content area to fit its content height.
|
||||
* It will retain a minimum height, which is the height of the content area when
|
||||
* it's initialized.
|
||||
*/
|
||||
tinymce.PluginManager.add('autoresize', function(editor) {
|
||||
var settings = editor.settings, oldSize = 0;
|
||||
|
||||
function isFullscreen() {
|
||||
return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
|
||||
}
|
||||
|
||||
if (editor.settings.inline) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets executed each time the editor needs to resize.
|
||||
*/
|
||||
function resize(e) {
|
||||
var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight,
|
||||
marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
|
||||
|
||||
doc = editor.getDoc();
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
body = doc.body;
|
||||
docElm = doc.documentElement;
|
||||
resizeHeight = settings.autoresize_min_height;
|
||||
|
||||
if (!body || (e && e.type === "setcontent" && e.initial) || isFullscreen()) {
|
||||
if (body && docElm) {
|
||||
body.style.overflowY = "auto";
|
||||
docElm.style.overflowY = "auto"; // Old IE
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate outer height of the body element using CSS styles
|
||||
marginTop = editor.dom.getStyle(body, 'margin-top', true);
|
||||
marginBottom = editor.dom.getStyle(body, 'margin-bottom', true);
|
||||
paddingTop = editor.dom.getStyle(body, 'padding-top', true);
|
||||
paddingBottom = editor.dom.getStyle(body, 'padding-bottom', true);
|
||||
borderTop = editor.dom.getStyle(body, 'border-top-width', true);
|
||||
borderBottom = editor.dom.getStyle(body, 'border-bottom-width', true);
|
||||
myHeight = body.offsetHeight + parseInt(marginTop, 10) + parseInt(marginBottom, 10) +
|
||||
parseInt(paddingTop, 10) + parseInt(paddingBottom, 10) +
|
||||
parseInt(borderTop, 10) + parseInt(borderBottom, 10);
|
||||
|
||||
// Make sure we have a valid height
|
||||
if (isNaN(myHeight) || myHeight <= 0) {
|
||||
// Get height differently depending on the browser used
|
||||
myHeight = tinymce.Env.ie ? body.scrollHeight : (tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight);
|
||||
}
|
||||
|
||||
// Don't make it smaller than the minimum height
|
||||
if (myHeight > settings.autoresize_min_height) {
|
||||
resizeHeight = myHeight;
|
||||
}
|
||||
|
||||
// If a maximum height has been defined don't exceed this height
|
||||
if (settings.autoresize_max_height && myHeight > settings.autoresize_max_height) {
|
||||
resizeHeight = settings.autoresize_max_height;
|
||||
body.style.overflowY = "auto";
|
||||
docElm.style.overflowY = "auto"; // Old IE
|
||||
} else {
|
||||
body.style.overflowY = "hidden";
|
||||
docElm.style.overflowY = "hidden"; // Old IE
|
||||
body.scrollTop = 0;
|
||||
}
|
||||
|
||||
// Resize content element
|
||||
if (resizeHeight !== oldSize) {
|
||||
deltaSize = resizeHeight - oldSize;
|
||||
DOM.setStyle(editor.iframeElement, 'height', resizeHeight + 'px');
|
||||
oldSize = resizeHeight;
|
||||
|
||||
// WebKit doesn't decrease the size of the body element until the iframe gets resized
|
||||
// So we need to continue to resize the iframe down until the size gets fixed
|
||||
if (tinymce.isWebKit && deltaSize < 0) {
|
||||
resize(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the resize x times in 100ms intervals. We can't wait for load events since
|
||||
* the CSS files might load async.
|
||||
*/
|
||||
function wait(times, interval, callback) {
|
||||
tinymce.util.Delay.setEditorTimeout(editor, function() {
|
||||
resize({});
|
||||
|
||||
if (times--) {
|
||||
wait(times, interval, callback);
|
||||
} else if (callback) {
|
||||
callback();
|
||||
}
|
||||
}, interval);
|
||||
}
|
||||
|
||||
// Define minimum height
|
||||
settings.autoresize_min_height = parseInt(editor.getParam('autoresize_min_height', editor.getElement().offsetHeight), 10);
|
||||
|
||||
// Define maximum height
|
||||
settings.autoresize_max_height = parseInt(editor.getParam('autoresize_max_height', 0), 10);
|
||||
|
||||
// Add padding at the bottom for better UX
|
||||
editor.on("init", function() {
|
||||
var overflowPadding, bottomMargin;
|
||||
|
||||
overflowPadding = editor.getParam('autoresize_overflow_padding', 1);
|
||||
bottomMargin = editor.getParam('autoresize_bottom_margin', 50);
|
||||
|
||||
if (overflowPadding !== false) {
|
||||
editor.dom.setStyles(editor.getBody(), {
|
||||
paddingLeft: overflowPadding,
|
||||
paddingRight: overflowPadding
|
||||
});
|
||||
}
|
||||
|
||||
if (bottomMargin !== false) {
|
||||
editor.dom.setStyles(editor.getBody(), {
|
||||
paddingBottom: bottomMargin
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Add appropriate listeners for resizing content area
|
||||
editor.on("nodechange setcontent keyup FullscreenStateChanged", resize);
|
||||
|
||||
if (editor.getParam('autoresize_on_init', true)) {
|
||||
editor.on('init', function() {
|
||||
// Hit it 20 times in 100 ms intervals
|
||||
wait(20, 100, function() {
|
||||
// Hit it 5 times in 1 sec intervals
|
||||
wait(5, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
editor.addCommand('mceAutoResize', resize);
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/autoresize/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("autoresize",function(a){function b(){return a.plugins.fullscreen&&a.plugins.fullscreen.isFullscreen()}function c(d){var g,h,i,j,k,l,m,n,o,p,q,r,s=tinymce.DOM;if(h=a.getDoc()){if(i=h.body,j=h.documentElement,k=e.autoresize_min_height,!i||d&&"setcontent"===d.type&&d.initial||b())return void(i&&j&&(i.style.overflowY="auto",j.style.overflowY="auto"));m=a.dom.getStyle(i,"margin-top",!0),n=a.dom.getStyle(i,"margin-bottom",!0),o=a.dom.getStyle(i,"padding-top",!0),p=a.dom.getStyle(i,"padding-bottom",!0),q=a.dom.getStyle(i,"border-top-width",!0),r=a.dom.getStyle(i,"border-bottom-width",!0),l=i.offsetHeight+parseInt(m,10)+parseInt(n,10)+parseInt(o,10)+parseInt(p,10)+parseInt(q,10)+parseInt(r,10),(isNaN(l)||0>=l)&&(l=tinymce.Env.ie?i.scrollHeight:tinymce.Env.webkit&&0===i.clientHeight?0:i.offsetHeight),l>e.autoresize_min_height&&(k=l),e.autoresize_max_height&&l>e.autoresize_max_height?(k=e.autoresize_max_height,i.style.overflowY="auto",j.style.overflowY="auto"):(i.style.overflowY="hidden",j.style.overflowY="hidden",i.scrollTop=0),k!==f&&(g=k-f,s.setStyle(a.iframeElement,"height",k+"px"),f=k,tinymce.isWebKit&&0>g&&c(d))}}function d(b,e,f){tinymce.util.Delay.setEditorTimeout(a,function(){c({}),b--?d(b,e,f):f&&f()},e)}var e=a.settings,f=0;a.settings.inline||(e.autoresize_min_height=parseInt(a.getParam("autoresize_min_height",a.getElement().offsetHeight),10),e.autoresize_max_height=parseInt(a.getParam("autoresize_max_height",0),10),a.on("init",function(){var b,c;b=a.getParam("autoresize_overflow_padding",1),c=a.getParam("autoresize_bottom_margin",50),b!==!1&&a.dom.setStyles(a.getBody(),{paddingLeft:b,paddingRight:b}),c!==!1&&a.dom.setStyles(a.getBody(),{paddingBottom:c})}),a.on("nodechange setcontent keyup FullscreenStateChanged",c),a.getParam("autoresize_on_init",!0)&&a.on("init",function(){d(20,100,function(){d(5,1e3)})}),a.addCommand("mceAutoResize",c))});
|
||||
165
assets/dashboard/plugins/tinymce/plugins/autosave/plugin.js
Normal file
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
// Internal unload handler will be called before the page is unloaded
|
||||
// Needs to be outside the plugin since it would otherwise keep
|
||||
// a reference to editor in closue scope
|
||||
/*eslint no-func-assign:0 */
|
||||
tinymce._beforeUnloadHandler = function() {
|
||||
var msg;
|
||||
|
||||
tinymce.each(tinymce.editors, function(editor) {
|
||||
// Store a draft for each editor instance
|
||||
if (editor.plugins.autosave) {
|
||||
editor.plugins.autosave.storeDraft();
|
||||
}
|
||||
|
||||
// Setup a return message if the editor is dirty
|
||||
if (!msg && editor.isDirty() && editor.getParam("autosave_ask_before_unload", true)) {
|
||||
msg = editor.translate("You have unsaved changes are you sure you want to navigate away?");
|
||||
}
|
||||
});
|
||||
|
||||
return msg;
|
||||
};
|
||||
|
||||
tinymce.PluginManager.add('autosave', function(editor) {
|
||||
var settings = editor.settings, LocalStorage = tinymce.util.LocalStorage, prefix, started;
|
||||
|
||||
prefix = settings.autosave_prefix || 'tinymce-autosave-{path}{query}-{id}-';
|
||||
prefix = prefix.replace(/\{path\}/g, document.location.pathname);
|
||||
prefix = prefix.replace(/\{query\}/g, document.location.search);
|
||||
prefix = prefix.replace(/\{id\}/g, editor.id);
|
||||
|
||||
function parseTime(time, defaultTime) {
|
||||
var multipels = {
|
||||
s: 1000,
|
||||
m: 60000
|
||||
};
|
||||
|
||||
time = /^(\d+)([ms]?)$/.exec('' + (time || defaultTime));
|
||||
|
||||
return (time[2] ? multipels[time[2]] : 1) * parseInt(time, 10);
|
||||
}
|
||||
|
||||
function hasDraft() {
|
||||
var time = parseInt(LocalStorage.getItem(prefix + "time"), 10) || 0;
|
||||
|
||||
if (new Date().getTime() - time > settings.autosave_retention) {
|
||||
removeDraft(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function removeDraft(fire) {
|
||||
LocalStorage.removeItem(prefix + "draft");
|
||||
LocalStorage.removeItem(prefix + "time");
|
||||
|
||||
if (fire !== false) {
|
||||
editor.fire('RemoveDraft');
|
||||
}
|
||||
}
|
||||
|
||||
function storeDraft() {
|
||||
if (!isEmpty() && editor.isDirty()) {
|
||||
LocalStorage.setItem(prefix + "draft", editor.getContent({format: 'raw', no_events: true}));
|
||||
LocalStorage.setItem(prefix + "time", new Date().getTime());
|
||||
editor.fire('StoreDraft');
|
||||
}
|
||||
}
|
||||
|
||||
function restoreDraft() {
|
||||
if (hasDraft()) {
|
||||
editor.setContent(LocalStorage.getItem(prefix + "draft"), {format: 'raw'});
|
||||
editor.fire('RestoreDraft');
|
||||
}
|
||||
}
|
||||
|
||||
function startStoreDraft() {
|
||||
if (!started) {
|
||||
setInterval(function() {
|
||||
if (!editor.removed) {
|
||||
storeDraft();
|
||||
}
|
||||
}, settings.autosave_interval);
|
||||
|
||||
started = true;
|
||||
}
|
||||
}
|
||||
|
||||
settings.autosave_interval = parseTime(settings.autosave_interval, '30s');
|
||||
settings.autosave_retention = parseTime(settings.autosave_retention, '20m');
|
||||
|
||||
function postRender() {
|
||||
var self = this;
|
||||
|
||||
self.disabled(!hasDraft());
|
||||
|
||||
editor.on('StoreDraft RestoreDraft RemoveDraft', function() {
|
||||
self.disabled(!hasDraft());
|
||||
});
|
||||
|
||||
startStoreDraft();
|
||||
}
|
||||
|
||||
function restoreLastDraft() {
|
||||
editor.undoManager.beforeChange();
|
||||
restoreDraft();
|
||||
removeDraft();
|
||||
editor.undoManager.add();
|
||||
}
|
||||
|
||||
editor.addButton('restoredraft', {
|
||||
title: 'Restore last draft',
|
||||
onclick: restoreLastDraft,
|
||||
onPostRender: postRender
|
||||
});
|
||||
|
||||
editor.addMenuItem('restoredraft', {
|
||||
text: 'Restore last draft',
|
||||
onclick: restoreLastDraft,
|
||||
onPostRender: postRender,
|
||||
context: 'file'
|
||||
});
|
||||
|
||||
function isEmpty(html) {
|
||||
var forcedRootBlockName = editor.settings.forced_root_block;
|
||||
|
||||
html = tinymce.trim(typeof html == "undefined" ? editor.getBody().innerHTML : html);
|
||||
|
||||
return html === '' || new RegExp(
|
||||
'^<' + forcedRootBlockName + '[^>]*>((\u00a0| |[ \t]|<br[^>]*>)+?|)<\/' + forcedRootBlockName + '>|<br>$', 'i'
|
||||
).test(html);
|
||||
}
|
||||
|
||||
if (editor.settings.autosave_restore_when_empty !== false) {
|
||||
editor.on('init', function() {
|
||||
if (hasDraft() && isEmpty()) {
|
||||
restoreDraft();
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('saveContent', function() {
|
||||
removeDraft();
|
||||
});
|
||||
}
|
||||
|
||||
window.onbeforeunload = tinymce._beforeUnloadHandler;
|
||||
|
||||
this.hasDraft = hasDraft;
|
||||
this.storeDraft = storeDraft;
|
||||
this.restoreDraft = restoreDraft;
|
||||
this.removeDraft = removeDraft;
|
||||
this.isEmpty = isEmpty;
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/autosave/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce._beforeUnloadHandler=function(){var a;return tinymce.each(tinymce.editors,function(b){b.plugins.autosave&&b.plugins.autosave.storeDraft(),!a&&b.isDirty()&&b.getParam("autosave_ask_before_unload",!0)&&(a=b.translate("You have unsaved changes are you sure you want to navigate away?"))}),a},tinymce.PluginManager.add("autosave",function(a){function b(a,b){var c={s:1e3,m:6e4};return a=/^(\d+)([ms]?)$/.exec(""+(a||b)),(a[2]?c[a[2]]:1)*parseInt(a,10)}function c(){var a=parseInt(n.getItem(k+"time"),10)||0;return(new Date).getTime()-a>m.autosave_retention?(d(!1),!1):!0}function d(b){n.removeItem(k+"draft"),n.removeItem(k+"time"),b!==!1&&a.fire("RemoveDraft")}function e(){!j()&&a.isDirty()&&(n.setItem(k+"draft",a.getContent({format:"raw",no_events:!0})),n.setItem(k+"time",(new Date).getTime()),a.fire("StoreDraft"))}function f(){c()&&(a.setContent(n.getItem(k+"draft"),{format:"raw"}),a.fire("RestoreDraft"))}function g(){l||(setInterval(function(){a.removed||e()},m.autosave_interval),l=!0)}function h(){var b=this;b.disabled(!c()),a.on("StoreDraft RestoreDraft RemoveDraft",function(){b.disabled(!c())}),g()}function i(){a.undoManager.beforeChange(),f(),d(),a.undoManager.add()}function j(b){var c=a.settings.forced_root_block;return b=tinymce.trim("undefined"==typeof b?a.getBody().innerHTML:b),""===b||new RegExp("^<"+c+"[^>]*>((\xa0| |[ ]|<br[^>]*>)+?|)</"+c+">|<br>$","i").test(b)}var k,l,m=a.settings,n=tinymce.util.LocalStorage;k=m.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",k=k.replace(/\{path\}/g,document.location.pathname),k=k.replace(/\{query\}/g,document.location.search),k=k.replace(/\{id\}/g,a.id),m.autosave_interval=b(m.autosave_interval,"30s"),m.autosave_retention=b(m.autosave_retention,"20m"),a.addButton("restoredraft",{title:"Restore last draft",onclick:i,onPostRender:h}),a.addMenuItem("restoredraft",{text:"Restore last draft",onclick:i,onPostRender:h,context:"file"}),a.settings.autosave_restore_when_empty!==!1&&(a.on("init",function(){c()&&j()&&f()}),a.on("saveContent",function(){d()})),window.onbeforeunload=tinymce._beforeUnloadHandler,this.hasDraft=c,this.storeDraft=e,this.restoreDraft=f,this.removeDraft=d,this.isEmpty=j});
|
||||
123
assets/dashboard/plugins/tinymce/plugins/bbcode/plugin.js
Normal file
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.BBCodePlugin', {
|
||||
init: function(ed) {
|
||||
var self = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
|
||||
|
||||
ed.on('beforeSetContent', function(e) {
|
||||
e.content = self['_' + dialect + '_bbcode2html'](e.content);
|
||||
});
|
||||
|
||||
ed.on('postProcess', function(e) {
|
||||
if (e.set) {
|
||||
e.content = self['_' + dialect + '_bbcode2html'](e.content);
|
||||
}
|
||||
|
||||
if (e.get) {
|
||||
e.content = self['_' + dialect + '_html2bbcode'](e.content);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getInfo: function() {
|
||||
return {
|
||||
longname: 'BBCode Plugin',
|
||||
author: 'Ephox Corp',
|
||||
authorurl: 'http://www.tinymce.com',
|
||||
infourl: 'http://www.tinymce.com/wiki.php/Plugin:bbcode'
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
// HTML -> BBCode in PunBB dialect
|
||||
_punbb_html2bbcode: function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
s = s.replace(re, str);
|
||||
}
|
||||
|
||||
// example: <strong> to [b]
|
||||
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi, "[url=$1]$2[/url]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi, "[code][color=$1]$2[/color][/code]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi, "[quote][color=$1]$2[/color][/quote]");
|
||||
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, "[code][color=$1]$2[/color][/code]");
|
||||
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, "[quote][color=$1]$2[/color][/quote]");
|
||||
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi, "[color=$1]$2[/color]");
|
||||
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi, "[color=$1]$2[/color]");
|
||||
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi, "[size=$1]$2[/size]");
|
||||
rep(/<font>(.*?)<\/font>/gi, "$1");
|
||||
rep(/<img.*?src=\"(.*?)\".*?\/>/gi, "[img]$1[/img]");
|
||||
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi, "[code]$1[/code]");
|
||||
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi, "[quote]$1[/quote]");
|
||||
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi, "[code][b]$1[/b][/code]");
|
||||
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi, "[quote][b]$1[/b][/quote]");
|
||||
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi, "[code][i]$1[/i][/code]");
|
||||
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi, "[quote][i]$1[/i][/quote]");
|
||||
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi, "[code][u]$1[/u][/code]");
|
||||
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi, "[quote][u]$1[/u][/quote]");
|
||||
rep(/<\/(strong|b)>/gi, "[/b]");
|
||||
rep(/<(strong|b)>/gi, "[b]");
|
||||
rep(/<\/(em|i)>/gi, "[/i]");
|
||||
rep(/<(em|i)>/gi, "[i]");
|
||||
rep(/<\/u>/gi, "[/u]");
|
||||
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi, "[u]$1[/u]");
|
||||
rep(/<u>/gi, "[u]");
|
||||
rep(/<blockquote[^>]*>/gi, "[quote]");
|
||||
rep(/<\/blockquote>/gi, "[/quote]");
|
||||
rep(/<br \/>/gi, "\n");
|
||||
rep(/<br\/>/gi, "\n");
|
||||
rep(/<br>/gi, "\n");
|
||||
rep(/<p>/gi, "");
|
||||
rep(/<\/p>/gi, "\n");
|
||||
rep(/ |\u00a0/gi, " ");
|
||||
rep(/"/gi, "\"");
|
||||
rep(/</gi, "<");
|
||||
rep(/>/gi, ">");
|
||||
rep(/&/gi, "&");
|
||||
|
||||
return s;
|
||||
},
|
||||
|
||||
// BBCode -> HTML from PunBB dialect
|
||||
_punbb_bbcode2html: function(s) {
|
||||
s = tinymce.trim(s);
|
||||
|
||||
function rep(re, str) {
|
||||
s = s.replace(re, str);
|
||||
}
|
||||
|
||||
// example: [b] to <strong>
|
||||
rep(/\n/gi, "<br />");
|
||||
rep(/\[b\]/gi, "<strong>");
|
||||
rep(/\[\/b\]/gi, "</strong>");
|
||||
rep(/\[i\]/gi, "<em>");
|
||||
rep(/\[\/i\]/gi, "</em>");
|
||||
rep(/\[u\]/gi, "<u>");
|
||||
rep(/\[\/u\]/gi, "</u>");
|
||||
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, "<a href=\"$1\">$2</a>");
|
||||
rep(/\[url\](.*?)\[\/url\]/gi, "<a href=\"$1\">$1</a>");
|
||||
rep(/\[img\](.*?)\[\/img\]/gi, "<img src=\"$1\" />");
|
||||
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, "<font color=\"$1\">$2</font>");
|
||||
rep(/\[code\](.*?)\[\/code\]/gi, "<span class=\"codeStyle\">$1</span> ");
|
||||
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, "<span class=\"quoteStyle\">$1</span> ");
|
||||
|
||||
return s;
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
|
||||
})();
|
||||
1
assets/dashboard/plugins/tinymce/plugins/bbcode/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a){var b=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.on("beforeSetContent",function(a){a.content=b["_"+c+"_bbcode2html"](a.content)}),a.on("postProcess",function(a){a.set&&(a.content=b["_"+c+"_bbcode2html"](a.content)),a.get&&(a.content=b["_"+c+"_html2bbcode"](a.content))})},getInfo:function(){return{longname:"BBCode Plugin",author:"Ephox Corp",authorurl:"http://www.tinymce.com",infourl:"http://www.tinymce.com/wiki.php/Plugin:bbcode"}},_punbb_html2bbcode:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),b(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),b(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),b(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),b(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),b(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),b(/<font>(.*?)<\/font>/gi,"$1"),b(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),b(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),b(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),b(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),b(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),b(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),b(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),b(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),b(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),b(/<\/(strong|b)>/gi,"[/b]"),b(/<(strong|b)>/gi,"[b]"),b(/<\/(em|i)>/gi,"[/i]"),b(/<(em|i)>/gi,"[i]"),b(/<\/u>/gi,"[/u]"),b(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),b(/<u>/gi,"[u]"),b(/<blockquote[^>]*>/gi,"[quote]"),b(/<\/blockquote>/gi,"[/quote]"),b(/<br \/>/gi,"\n"),b(/<br\/>/gi,"\n"),b(/<br>/gi,"\n"),b(/<p>/gi,""),b(/<\/p>/gi,"\n"),b(/ |\u00a0/gi," "),b(/"/gi,'"'),b(/</gi,"<"),b(/>/gi,">"),b(/&/gi,"&"),a},_punbb_bbcode2html:function(a){function b(b,c){a=a.replace(b,c)}return a=tinymce.trim(a),b(/\n/gi,"<br />"),b(/\[b\]/gi,"<strong>"),b(/\[\/b\]/gi,"</strong>"),b(/\[i\]/gi,"<em>"),b(/\[\/i\]/gi,"</em>"),b(/\[u\]/gi,"<u>"),b(/\[\/u\]/gi,"</u>"),b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),b(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),b(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> '),b(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> '),a}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}();
|
||||
462
assets/dashboard/plugins/tinymce/plugins/charmap/plugin.js
Normal file
@@ -0,0 +1,462 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('charmap', function(editor) {
|
||||
var isArray = tinymce.util.Tools.isArray;
|
||||
|
||||
function getDefaultCharMap() {
|
||||
return [
|
||||
['160', 'no-break space'],
|
||||
['173', 'soft hyphen'],
|
||||
['34', 'quotation mark'],
|
||||
// finance
|
||||
['162', 'cent sign'],
|
||||
['8364', 'euro sign'],
|
||||
['163', 'pound sign'],
|
||||
['165', 'yen sign'],
|
||||
// signs
|
||||
['169', 'copyright sign'],
|
||||
['174', 'registered sign'],
|
||||
['8482', 'trade mark sign'],
|
||||
['8240', 'per mille sign'],
|
||||
['181', 'micro sign'],
|
||||
['183', 'middle dot'],
|
||||
['8226', 'bullet'],
|
||||
['8230', 'three dot leader'],
|
||||
['8242', 'minutes / feet'],
|
||||
['8243', 'seconds / inches'],
|
||||
['167', 'section sign'],
|
||||
['182', 'paragraph sign'],
|
||||
['223', 'sharp s / ess-zed'],
|
||||
// quotations
|
||||
['8249', 'single left-pointing angle quotation mark'],
|
||||
['8250', 'single right-pointing angle quotation mark'],
|
||||
['171', 'left pointing guillemet'],
|
||||
['187', 'right pointing guillemet'],
|
||||
['8216', 'left single quotation mark'],
|
||||
['8217', 'right single quotation mark'],
|
||||
['8220', 'left double quotation mark'],
|
||||
['8221', 'right double quotation mark'],
|
||||
['8218', 'single low-9 quotation mark'],
|
||||
['8222', 'double low-9 quotation mark'],
|
||||
['60', 'less-than sign'],
|
||||
['62', 'greater-than sign'],
|
||||
['8804', 'less-than or equal to'],
|
||||
['8805', 'greater-than or equal to'],
|
||||
['8211', 'en dash'],
|
||||
['8212', 'em dash'],
|
||||
['175', 'macron'],
|
||||
['8254', 'overline'],
|
||||
['164', 'currency sign'],
|
||||
['166', 'broken bar'],
|
||||
['168', 'diaeresis'],
|
||||
['161', 'inverted exclamation mark'],
|
||||
['191', 'turned question mark'],
|
||||
['710', 'circumflex accent'],
|
||||
['732', 'small tilde'],
|
||||
['176', 'degree sign'],
|
||||
['8722', 'minus sign'],
|
||||
['177', 'plus-minus sign'],
|
||||
['247', 'division sign'],
|
||||
['8260', 'fraction slash'],
|
||||
['215', 'multiplication sign'],
|
||||
['185', 'superscript one'],
|
||||
['178', 'superscript two'],
|
||||
['179', 'superscript three'],
|
||||
['188', 'fraction one quarter'],
|
||||
['189', 'fraction one half'],
|
||||
['190', 'fraction three quarters'],
|
||||
// math / logical
|
||||
['402', 'function / florin'],
|
||||
['8747', 'integral'],
|
||||
['8721', 'n-ary sumation'],
|
||||
['8734', 'infinity'],
|
||||
['8730', 'square root'],
|
||||
['8764', 'similar to'],
|
||||
['8773', 'approximately equal to'],
|
||||
['8776', 'almost equal to'],
|
||||
['8800', 'not equal to'],
|
||||
['8801', 'identical to'],
|
||||
['8712', 'element of'],
|
||||
['8713', 'not an element of'],
|
||||
['8715', 'contains as member'],
|
||||
['8719', 'n-ary product'],
|
||||
['8743', 'logical and'],
|
||||
['8744', 'logical or'],
|
||||
['172', 'not sign'],
|
||||
['8745', 'intersection'],
|
||||
['8746', 'union'],
|
||||
['8706', 'partial differential'],
|
||||
['8704', 'for all'],
|
||||
['8707', 'there exists'],
|
||||
['8709', 'diameter'],
|
||||
['8711', 'backward difference'],
|
||||
['8727', 'asterisk operator'],
|
||||
['8733', 'proportional to'],
|
||||
['8736', 'angle'],
|
||||
// undefined
|
||||
['180', 'acute accent'],
|
||||
['184', 'cedilla'],
|
||||
['170', 'feminine ordinal indicator'],
|
||||
['186', 'masculine ordinal indicator'],
|
||||
['8224', 'dagger'],
|
||||
['8225', 'double dagger'],
|
||||
// alphabetical special chars
|
||||
['192', 'A - grave'],
|
||||
['193', 'A - acute'],
|
||||
['194', 'A - circumflex'],
|
||||
['195', 'A - tilde'],
|
||||
['196', 'A - diaeresis'],
|
||||
['197', 'A - ring above'],
|
||||
['256', 'A - macron'],
|
||||
['198', 'ligature AE'],
|
||||
['199', 'C - cedilla'],
|
||||
['200', 'E - grave'],
|
||||
['201', 'E - acute'],
|
||||
['202', 'E - circumflex'],
|
||||
['203', 'E - diaeresis'],
|
||||
['274', 'E - macron'],
|
||||
['204', 'I - grave'],
|
||||
['205', 'I - acute'],
|
||||
['206', 'I - circumflex'],
|
||||
['207', 'I - diaeresis'],
|
||||
['298', 'I - macron'],
|
||||
['208', 'ETH'],
|
||||
['209', 'N - tilde'],
|
||||
['210', 'O - grave'],
|
||||
['211', 'O - acute'],
|
||||
['212', 'O - circumflex'],
|
||||
['213', 'O - tilde'],
|
||||
['214', 'O - diaeresis'],
|
||||
['216', 'O - slash'],
|
||||
['332', 'O - macron'],
|
||||
['338', 'ligature OE'],
|
||||
['352', 'S - caron'],
|
||||
['217', 'U - grave'],
|
||||
['218', 'U - acute'],
|
||||
['219', 'U - circumflex'],
|
||||
['220', 'U - diaeresis'],
|
||||
['362', 'U - macron'],
|
||||
['221', 'Y - acute'],
|
||||
['376', 'Y - diaeresis'],
|
||||
['562', 'Y - macron'],
|
||||
['222', 'THORN'],
|
||||
['224', 'a - grave'],
|
||||
['225', 'a - acute'],
|
||||
['226', 'a - circumflex'],
|
||||
['227', 'a - tilde'],
|
||||
['228', 'a - diaeresis'],
|
||||
['229', 'a - ring above'],
|
||||
['257', 'a - macron'],
|
||||
['230', 'ligature ae'],
|
||||
['231', 'c - cedilla'],
|
||||
['232', 'e - grave'],
|
||||
['233', 'e - acute'],
|
||||
['234', 'e - circumflex'],
|
||||
['235', 'e - diaeresis'],
|
||||
['275', 'e - macron'],
|
||||
['236', 'i - grave'],
|
||||
['237', 'i - acute'],
|
||||
['238', 'i - circumflex'],
|
||||
['239', 'i - diaeresis'],
|
||||
['299', 'i - macron'],
|
||||
['240', 'eth'],
|
||||
['241', 'n - tilde'],
|
||||
['242', 'o - grave'],
|
||||
['243', 'o - acute'],
|
||||
['244', 'o - circumflex'],
|
||||
['245', 'o - tilde'],
|
||||
['246', 'o - diaeresis'],
|
||||
['248', 'o slash'],
|
||||
['333', 'o macron'],
|
||||
['339', 'ligature oe'],
|
||||
['353', 's - caron'],
|
||||
['249', 'u - grave'],
|
||||
['250', 'u - acute'],
|
||||
['251', 'u - circumflex'],
|
||||
['252', 'u - diaeresis'],
|
||||
['363', 'u - macron'],
|
||||
['253', 'y - acute'],
|
||||
['254', 'thorn'],
|
||||
['255', 'y - diaeresis'],
|
||||
['563', 'y - macron'],
|
||||
['913', 'Alpha'],
|
||||
['914', 'Beta'],
|
||||
['915', 'Gamma'],
|
||||
['916', 'Delta'],
|
||||
['917', 'Epsilon'],
|
||||
['918', 'Zeta'],
|
||||
['919', 'Eta'],
|
||||
['920', 'Theta'],
|
||||
['921', 'Iota'],
|
||||
['922', 'Kappa'],
|
||||
['923', 'Lambda'],
|
||||
['924', 'Mu'],
|
||||
['925', 'Nu'],
|
||||
['926', 'Xi'],
|
||||
['927', 'Omicron'],
|
||||
['928', 'Pi'],
|
||||
['929', 'Rho'],
|
||||
['931', 'Sigma'],
|
||||
['932', 'Tau'],
|
||||
['933', 'Upsilon'],
|
||||
['934', 'Phi'],
|
||||
['935', 'Chi'],
|
||||
['936', 'Psi'],
|
||||
['937', 'Omega'],
|
||||
['945', 'alpha'],
|
||||
['946', 'beta'],
|
||||
['947', 'gamma'],
|
||||
['948', 'delta'],
|
||||
['949', 'epsilon'],
|
||||
['950', 'zeta'],
|
||||
['951', 'eta'],
|
||||
['952', 'theta'],
|
||||
['953', 'iota'],
|
||||
['954', 'kappa'],
|
||||
['955', 'lambda'],
|
||||
['956', 'mu'],
|
||||
['957', 'nu'],
|
||||
['958', 'xi'],
|
||||
['959', 'omicron'],
|
||||
['960', 'pi'],
|
||||
['961', 'rho'],
|
||||
['962', 'final sigma'],
|
||||
['963', 'sigma'],
|
||||
['964', 'tau'],
|
||||
['965', 'upsilon'],
|
||||
['966', 'phi'],
|
||||
['967', 'chi'],
|
||||
['968', 'psi'],
|
||||
['969', 'omega'],
|
||||
// symbols
|
||||
['8501', 'alef symbol'],
|
||||
['982', 'pi symbol'],
|
||||
['8476', 'real part symbol'],
|
||||
['978', 'upsilon - hook symbol'],
|
||||
['8472', 'Weierstrass p'],
|
||||
['8465', 'imaginary part'],
|
||||
// arrows
|
||||
['8592', 'leftwards arrow'],
|
||||
['8593', 'upwards arrow'],
|
||||
['8594', 'rightwards arrow'],
|
||||
['8595', 'downwards arrow'],
|
||||
['8596', 'left right arrow'],
|
||||
['8629', 'carriage return'],
|
||||
['8656', 'leftwards double arrow'],
|
||||
['8657', 'upwards double arrow'],
|
||||
['8658', 'rightwards double arrow'],
|
||||
['8659', 'downwards double arrow'],
|
||||
['8660', 'left right double arrow'],
|
||||
['8756', 'therefore'],
|
||||
['8834', 'subset of'],
|
||||
['8835', 'superset of'],
|
||||
['8836', 'not a subset of'],
|
||||
['8838', 'subset of or equal to'],
|
||||
['8839', 'superset of or equal to'],
|
||||
['8853', 'circled plus'],
|
||||
['8855', 'circled times'],
|
||||
['8869', 'perpendicular'],
|
||||
['8901', 'dot operator'],
|
||||
['8968', 'left ceiling'],
|
||||
['8969', 'right ceiling'],
|
||||
['8970', 'left floor'],
|
||||
['8971', 'right floor'],
|
||||
['9001', 'left-pointing angle bracket'],
|
||||
['9002', 'right-pointing angle bracket'],
|
||||
['9674', 'lozenge'],
|
||||
['9824', 'black spade suit'],
|
||||
['9827', 'black club suit'],
|
||||
['9829', 'black heart suit'],
|
||||
['9830', 'black diamond suit'],
|
||||
['8194', 'en space'],
|
||||
['8195', 'em space'],
|
||||
['8201', 'thin space'],
|
||||
['8204', 'zero width non-joiner'],
|
||||
['8205', 'zero width joiner'],
|
||||
['8206', 'left-to-right mark'],
|
||||
['8207', 'right-to-left mark']
|
||||
];
|
||||
}
|
||||
|
||||
function charmapFilter(charmap) {
|
||||
return tinymce.util.Tools.grep(charmap, function(item) {
|
||||
return isArray(item) && item.length == 2;
|
||||
});
|
||||
}
|
||||
|
||||
function getCharsFromSetting(settingValue) {
|
||||
if (isArray(settingValue)) {
|
||||
return [].concat(charmapFilter(settingValue));
|
||||
}
|
||||
|
||||
if (typeof settingValue == "function") {
|
||||
return settingValue();
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
function extendCharMap(charmap) {
|
||||
var settings = editor.settings;
|
||||
|
||||
if (settings.charmap) {
|
||||
charmap = getCharsFromSetting(settings.charmap);
|
||||
}
|
||||
|
||||
if (settings.charmap_append) {
|
||||
return [].concat(charmap).concat(getCharsFromSetting(settings.charmap_append));
|
||||
}
|
||||
|
||||
return charmap;
|
||||
}
|
||||
|
||||
function getCharMap() {
|
||||
return extendCharMap(getDefaultCharMap());
|
||||
}
|
||||
|
||||
function insertChar(chr) {
|
||||
editor.fire('insertCustomChar', {chr: chr}).chr;
|
||||
editor.execCommand('mceInsertContent', false, chr);
|
||||
}
|
||||
|
||||
function showDialog() {
|
||||
var gridHtml, x, y, win;
|
||||
|
||||
function getParentTd(elm) {
|
||||
while (elm) {
|
||||
if (elm.nodeName == 'TD') {
|
||||
return elm;
|
||||
}
|
||||
|
||||
elm = elm.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
gridHtml = '<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';
|
||||
|
||||
var charmap = getCharMap();
|
||||
var width = Math.min(charmap.length, 25);
|
||||
var height = Math.ceil(charmap.length / width);
|
||||
for (y = 0; y < height; y++) {
|
||||
gridHtml += '<tr>';
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
var index = y * width + x;
|
||||
if (index < charmap.length) {
|
||||
var chr = charmap[index];
|
||||
|
||||
gridHtml += '<td title="' + chr[1] + '"><div tabindex="-1" title="' + chr[1] + '" role="button">' +
|
||||
(chr ? String.fromCharCode(parseInt(chr[0], 10)) : ' ') + '</div></td>';
|
||||
} else {
|
||||
gridHtml += '<td />';
|
||||
}
|
||||
}
|
||||
|
||||
gridHtml += '</tr>';
|
||||
}
|
||||
|
||||
gridHtml += '</tbody></table>';
|
||||
|
||||
var charMapPanel = {
|
||||
type: 'container',
|
||||
html: gridHtml,
|
||||
onclick: function(e) {
|
||||
var target = e.target;
|
||||
|
||||
if (/^(TD|DIV)$/.test(target.nodeName)) {
|
||||
if (getParentTd(target).firstChild) {
|
||||
insertChar(tinymce.trim(target.innerText || target.textContent));
|
||||
|
||||
if (!e.ctrlKey) {
|
||||
win.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onmouseover: function(e) {
|
||||
var td = getParentTd(e.target);
|
||||
|
||||
if (td && td.firstChild) {
|
||||
win.find('#preview').text(td.firstChild.firstChild.data);
|
||||
win.find('#previewTitle').text(td.title);
|
||||
} else {
|
||||
win.find('#preview').text(' ');
|
||||
win.find('#previewTitle').text(' ');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
win = editor.windowManager.open({
|
||||
title: "Special character",
|
||||
spacing: 10,
|
||||
padding: 10,
|
||||
items: [
|
||||
charMapPanel,
|
||||
{
|
||||
type: 'container',
|
||||
layout: 'flex',
|
||||
direction: 'column',
|
||||
align: 'center',
|
||||
spacing: 5,
|
||||
minWidth: 160,
|
||||
minHeight: 160,
|
||||
items: [
|
||||
{
|
||||
type: 'label',
|
||||
name: 'preview',
|
||||
text: ' ',
|
||||
style: 'font-size: 40px; text-align: center',
|
||||
border: 1,
|
||||
minWidth: 140,
|
||||
minHeight: 80
|
||||
},
|
||||
{
|
||||
type: 'label',
|
||||
name: 'previewTitle',
|
||||
text: ' ',
|
||||
style: 'text-align: center',
|
||||
border: 1,
|
||||
minWidth: 140,
|
||||
minHeight: 80
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
buttons: [
|
||||
{text: "Close", onclick: function() {
|
||||
win.close();
|
||||
}}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
editor.addCommand('mceShowCharmap', showDialog);
|
||||
|
||||
editor.addButton('charmap', {
|
||||
icon: 'charmap',
|
||||
tooltip: 'Special character',
|
||||
cmd: 'mceShowCharmap'
|
||||
});
|
||||
|
||||
editor.addMenuItem('charmap', {
|
||||
icon: 'charmap',
|
||||
text: 'Special character',
|
||||
cmd: 'mceShowCharmap',
|
||||
context: 'insert'
|
||||
});
|
||||
|
||||
return {
|
||||
getCharMap: getCharMap,
|
||||
insertChar: insertChar
|
||||
};
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/charmap/plugin.min.js
vendored
Normal file
60
assets/dashboard/plugins/tinymce/plugins/code/plugin.js
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('code', function(editor) {
|
||||
function showDialog() {
|
||||
var win = editor.windowManager.open({
|
||||
title: "Source code",
|
||||
body: {
|
||||
type: 'textbox',
|
||||
name: 'code',
|
||||
multiline: true,
|
||||
minWidth: editor.getParam("code_dialog_width", 600),
|
||||
minHeight: editor.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)),
|
||||
spellcheck: false,
|
||||
style: 'direction: ltr; text-align: left'
|
||||
},
|
||||
onSubmit: function(e) {
|
||||
// We get a lovely "Wrong document" error in IE 11 if we
|
||||
// don't move the focus to the editor before creating an undo
|
||||
// transation since it tries to make a bookmark for the current selection
|
||||
editor.focus();
|
||||
|
||||
editor.undoManager.transact(function() {
|
||||
editor.setContent(e.data.code);
|
||||
});
|
||||
|
||||
editor.selection.setCursorLocation();
|
||||
editor.nodeChanged();
|
||||
}
|
||||
});
|
||||
|
||||
// Gecko has a major performance issue with textarea
|
||||
// contents so we need to set it when all reflows are done
|
||||
win.find('#code').value(editor.getContent({source_view: true}));
|
||||
}
|
||||
|
||||
editor.addCommand("mceCodeEditor", showDialog);
|
||||
|
||||
editor.addButton('code', {
|
||||
icon: 'code',
|
||||
tooltip: 'Source code',
|
||||
onclick: showDialog
|
||||
});
|
||||
|
||||
editor.addMenuItem('code', {
|
||||
icon: 'code',
|
||||
text: 'Source code',
|
||||
context: 'tools',
|
||||
onclick: showDialog
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/code/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("code",function(a){function b(){var b=a.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:a.getParam("code_dialog_width",600),minHeight:a.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(b){a.focus(),a.undoManager.transact(function(){a.setContent(b.data.code)}),a.selection.setCursorLocation(),a.nodeChanged()}});b.find("#code").value(a.getContent({source_view:!0}))}a.addCommand("mceCodeEditor",b),a.addButton("code",{icon:"code",tooltip:"Source code",onclick:b}),a.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:b})});
|
||||
@@ -0,0 +1,138 @@
|
||||
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */
|
||||
/**
|
||||
* prism.js default theme for JavaScript, CSS and HTML
|
||||
* Based on dabblet (http://dabblet.com)
|
||||
* @author Lea Verou
|
||||
*/
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
color: black;
|
||||
text-shadow: 0 1px white;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
line-height: 1.5;
|
||||
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
||||
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
||||
code[class*="language-"]::selection, code[class*="language-"] ::selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
@media print {
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
text-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
padding: 1em;
|
||||
margin: .5em 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
:not(pre) > code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
background: #f5f2f0;
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
padding: .1em;
|
||||
border-radius: .3em;
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.prolog,
|
||||
.token.doctype,
|
||||
.token.cdata {
|
||||
color: slategray;
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.namespace {
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.token.property,
|
||||
.token.tag,
|
||||
.token.boolean,
|
||||
.token.number,
|
||||
.token.constant,
|
||||
.token.symbol,
|
||||
.token.deleted {
|
||||
color: #905;
|
||||
}
|
||||
|
||||
.token.selector,
|
||||
.token.attr-name,
|
||||
.token.string,
|
||||
.token.char,
|
||||
.token.builtin,
|
||||
.token.inserted {
|
||||
color: #690;
|
||||
}
|
||||
|
||||
.token.operator,
|
||||
.token.entity,
|
||||
.token.url,
|
||||
.language-css .token.string,
|
||||
.style .token.string {
|
||||
color: #a67f59;
|
||||
background: hsla(0, 0%, 100%, .5);
|
||||
}
|
||||
|
||||
.token.atrule,
|
||||
.token.attr-value,
|
||||
.token.keyword {
|
||||
color: #07a;
|
||||
}
|
||||
|
||||
.token.function {
|
||||
color: #DD4A68;
|
||||
}
|
||||
|
||||
.token.regex,
|
||||
.token.important,
|
||||
.token.variable {
|
||||
color: #e90;
|
||||
}
|
||||
|
||||
.token.important,
|
||||
.token.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.token.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
1312
assets/dashboard/plugins/tinymce/plugins/codesample/plugin.js
Normal file
1
assets/dashboard/plugins/tinymce/plugins/codesample/plugin.min.js
vendored
Normal file
112
assets/dashboard/plugins/tinymce/plugins/colorpicker/plugin.js
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('colorpicker', function(editor) {
|
||||
function colorPickerCallback(callback, value) {
|
||||
function setColor(value) {
|
||||
var color = new tinymce.util.Color(value), rgb = color.toRgb();
|
||||
|
||||
win.fromJSON({
|
||||
r: rgb.r,
|
||||
g: rgb.g,
|
||||
b: rgb.b,
|
||||
hex: color.toHex().substr(1)
|
||||
});
|
||||
|
||||
showPreview(color.toHex());
|
||||
}
|
||||
|
||||
function showPreview(hexColor) {
|
||||
win.find('#preview')[0].getEl().style.background = hexColor;
|
||||
}
|
||||
|
||||
var win = editor.windowManager.open({
|
||||
title: 'Color',
|
||||
items: {
|
||||
type: 'container',
|
||||
layout: 'flex',
|
||||
direction: 'row',
|
||||
align: 'stretch',
|
||||
padding: 5,
|
||||
spacing: 10,
|
||||
items: [
|
||||
{
|
||||
type: 'colorpicker',
|
||||
value: value,
|
||||
onchange: function() {
|
||||
var rgb = this.rgb();
|
||||
|
||||
if (win) {
|
||||
win.find('#r').value(rgb.r);
|
||||
win.find('#g').value(rgb.g);
|
||||
win.find('#b').value(rgb.b);
|
||||
win.find('#hex').value(this.value().substr(1));
|
||||
showPreview(this.value());
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'form',
|
||||
padding: 0,
|
||||
labelGap: 5,
|
||||
defaults: {
|
||||
type: 'textbox',
|
||||
size: 7,
|
||||
value: '0',
|
||||
flex: 1,
|
||||
spellcheck: false,
|
||||
onchange: function() {
|
||||
var colorPickerCtrl = win.find('colorpicker')[0];
|
||||
var name, value;
|
||||
|
||||
name = this.name();
|
||||
value = this.value();
|
||||
|
||||
if (name == "hex") {
|
||||
value = '#' + value;
|
||||
setColor(value);
|
||||
colorPickerCtrl.value(value);
|
||||
return;
|
||||
}
|
||||
|
||||
value = {
|
||||
r: win.find('#r').value(),
|
||||
g: win.find('#g').value(),
|
||||
b: win.find('#b').value()
|
||||
};
|
||||
|
||||
colorPickerCtrl.value(value);
|
||||
setColor(value);
|
||||
}
|
||||
},
|
||||
items: [
|
||||
{name: 'r', label: 'R', autofocus: 1},
|
||||
{name: 'g', label: 'G'},
|
||||
{name: 'b', label: 'B'},
|
||||
{name: 'hex', label: '#', value: '000000'},
|
||||
{name: 'preview', type: 'container', border: 1}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
onSubmit: function() {
|
||||
callback('#' + this.toJSON().hex);
|
||||
}
|
||||
});
|
||||
|
||||
setColor(value);
|
||||
}
|
||||
|
||||
if (!editor.settings.color_picker_callback) {
|
||||
editor.settings.color_picker_callback = colorPickerCallback;
|
||||
}
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/colorpicker/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("colorpicker",function(a){function b(b,c){function d(a){var b=new tinymce.util.Color(a),c=b.toRgb();f.fromJSON({r:c.r,g:c.g,b:c.b,hex:b.toHex().substr(1)}),e(b.toHex())}function e(a){f.find("#preview")[0].getEl().style.background=a}var f=a.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:c,onchange:function(){var a=this.rgb();f&&(f.find("#r").value(a.r),f.find("#g").value(a.g),f.find("#b").value(a.b),f.find("#hex").value(this.value().substr(1)),e(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var a,b,c=f.find("colorpicker")[0];return a=this.name(),b=this.value(),"hex"==a?(b="#"+b,d(b),void c.value(b)):(b={r:f.find("#r").value(),g:f.find("#g").value(),b:f.find("#b").value()},c.value(b),void d(b))}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){b("#"+this.toJSON().hex)}});d(c)}a.settings.color_picker_callback||(a.settings.color_picker_callback=b)});
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('contextmenu', function(editor) {
|
||||
var menu, contextmenuNeverUseNative = editor.settings.contextmenu_never_use_native;
|
||||
|
||||
editor.on('contextmenu', function(e) {
|
||||
var contextmenu, doc = editor.getDoc();
|
||||
|
||||
// Block TinyMCE menu on ctrlKey
|
||||
if (e.ctrlKey && !contextmenuNeverUseNative) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
/**
|
||||
* WebKit/Blink on Mac has the odd behavior of selecting the target word or line this causes
|
||||
* issues when for example inserting images see: #7022
|
||||
*/
|
||||
if (tinymce.Env.mac && tinymce.Env.webkit) {
|
||||
if (e.button == 2 && doc.caretRangeFromPoint) {
|
||||
editor.selection.setRng(doc.caretRangeFromPoint(e.x, e.y));
|
||||
}
|
||||
}
|
||||
|
||||
contextmenu = editor.settings.contextmenu || 'link image inserttable | cell row column deletetable';
|
||||
|
||||
// Render menu
|
||||
if (!menu) {
|
||||
var items = [];
|
||||
|
||||
tinymce.each(contextmenu.split(/[ ,]/), function(name) {
|
||||
var item = editor.menuItems[name];
|
||||
|
||||
if (name == '|') {
|
||||
item = {text: name};
|
||||
}
|
||||
|
||||
if (item) {
|
||||
item.shortcut = ''; // Hide shortcuts
|
||||
items.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].text == '|') {
|
||||
if (i === 0 || i == items.length - 1) {
|
||||
items.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu = new tinymce.ui.Menu({
|
||||
items: items,
|
||||
context: 'contextmenu',
|
||||
classes: 'contextmenu'
|
||||
}).renderTo();
|
||||
|
||||
editor.on('remove', function() {
|
||||
menu.remove();
|
||||
menu = null;
|
||||
});
|
||||
} else {
|
||||
menu.show();
|
||||
}
|
||||
|
||||
// Position menu
|
||||
var pos = {x: e.pageX, y: e.pageY};
|
||||
|
||||
if (!editor.inline) {
|
||||
pos = tinymce.DOM.getPos(editor.getContentAreaContainer());
|
||||
pos.x += e.clientX;
|
||||
pos.y += e.clientY;
|
||||
}
|
||||
|
||||
menu.moveTo(pos.x, pos.y);
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/contextmenu/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("contextmenu",function(a){var b,c=a.settings.contextmenu_never_use_native;a.on("contextmenu",function(d){var e,f=a.getDoc();if(!d.ctrlKey||c){if(d.preventDefault(),tinymce.Env.mac&&tinymce.Env.webkit&&2==d.button&&f.caretRangeFromPoint&&a.selection.setRng(f.caretRangeFromPoint(d.x,d.y)),e=a.settings.contextmenu||"link image inserttable | cell row column deletetable",b)b.show();else{var g=[];tinymce.each(e.split(/[ ,]/),function(b){var c=a.menuItems[b];"|"==b&&(c={text:b}),c&&(c.shortcut="",g.push(c))});for(var h=0;h<g.length;h++)"|"==g[h].text&&(0!==h&&h!=g.length-1||g.splice(h,1));b=new tinymce.ui.Menu({items:g,context:"contextmenu",classes:"contextmenu"}).renderTo(),a.on("remove",function(){b.remove(),b=null})}var i={x:d.pageX,y:d.pageY};a.inline||(i=tinymce.DOM.getPos(a.getContentAreaContainer()),i.x+=d.clientX,i.y+=d.clientY),b.moveTo(i.x,i.y)}})});
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('directionality', function(editor) {
|
||||
function setDir(dir) {
|
||||
var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks();
|
||||
|
||||
if (blocks.length) {
|
||||
curDir = dom.getAttrib(blocks[0], "dir");
|
||||
|
||||
tinymce.each(blocks, function(block) {
|
||||
// Add dir to block if the parent block doesn't already have that dir
|
||||
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
|
||||
if (curDir != dir) {
|
||||
dom.setAttrib(block, "dir", dir);
|
||||
} else {
|
||||
dom.setAttrib(block, "dir", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.nodeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
function generateSelector(dir) {
|
||||
var selector = [];
|
||||
|
||||
tinymce.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function(name) {
|
||||
selector.push(name + '[dir=' + dir + ']');
|
||||
});
|
||||
|
||||
return selector.join(',');
|
||||
}
|
||||
|
||||
editor.addCommand('mceDirectionLTR', function() {
|
||||
setDir("ltr");
|
||||
});
|
||||
|
||||
editor.addCommand('mceDirectionRTL', function() {
|
||||
setDir("rtl");
|
||||
});
|
||||
|
||||
editor.addButton('ltr', {
|
||||
title: 'Left to right',
|
||||
cmd: 'mceDirectionLTR',
|
||||
stateSelector: generateSelector('ltr')
|
||||
});
|
||||
|
||||
editor.addButton('rtl', {
|
||||
title: 'Right to left',
|
||||
cmd: 'mceDirectionRTL',
|
||||
stateSelector: generateSelector('rtl')
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/directionality/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("directionality",function(a){function b(b){var c,d=a.dom,e=a.selection.getSelectedBlocks();e.length&&(c=d.getAttrib(e[0],"dir"),tinymce.each(e,function(a){d.getParent(a.parentNode,"*[dir='"+b+"']",d.getRoot())||(c!=b?d.setAttrib(a,"dir",b):d.setAttrib(a,"dir",null))}),a.nodeChanged())}function c(a){var b=[];return tinymce.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(c){b.push(c+"[dir="+a+"]")}),b.join(",")}a.addCommand("mceDirectionLTR",function(){b("ltr")}),a.addCommand("mceDirectionRTL",function(){b("rtl")}),a.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:c("ltr")}),a.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:c("rtl")})});
|
||||
|
After Width: | Height: | Size: 354 B |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 331 B |
|
After Width: | Height: | Size: 342 B |
|
After Width: | Height: | Size: 340 B |
|
After Width: | Height: | Size: 336 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 343 B |
|
After Width: | Height: | Size: 321 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 344 B |
|
After Width: | Height: | Size: 338 B |
|
After Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 336 B |
65
assets/dashboard/plugins/tinymce/plugins/emoticons/plugin.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('emoticons', function(editor, url) {
|
||||
var emoticons = [
|
||||
["cool", "cry", "embarassed", "foot-in-mouth"],
|
||||
["frown", "innocent", "kiss", "laughing"],
|
||||
["money-mouth", "sealed", "smile", "surprised"],
|
||||
["tongue-out", "undecided", "wink", "yell"]
|
||||
];
|
||||
|
||||
function getHtml() {
|
||||
var emoticonsHtml;
|
||||
|
||||
emoticonsHtml = '<table role="list" class="mce-grid">';
|
||||
|
||||
tinymce.each(emoticons, function(row) {
|
||||
emoticonsHtml += '<tr>';
|
||||
|
||||
tinymce.each(row, function(icon) {
|
||||
var emoticonUrl = url + '/img/smiley-' + icon + '.gif';
|
||||
|
||||
emoticonsHtml += '<td><a href="#" data-mce-url="' + emoticonUrl + '" data-mce-alt="' + icon + '" tabindex="-1" ' +
|
||||
'role="option" aria-label="' + icon + '"><img src="' +
|
||||
emoticonUrl + '" style="width: 18px; height: 18px" role="presentation" /></a></td>';
|
||||
});
|
||||
|
||||
emoticonsHtml += '</tr>';
|
||||
});
|
||||
|
||||
emoticonsHtml += '</table>';
|
||||
|
||||
return emoticonsHtml;
|
||||
}
|
||||
|
||||
editor.addButton('emoticons', {
|
||||
type: 'panelbutton',
|
||||
panel: {
|
||||
role: 'application',
|
||||
autohide: true,
|
||||
html: getHtml,
|
||||
onclick: function(e) {
|
||||
var linkElm = editor.dom.getParent(e.target, 'a');
|
||||
|
||||
if (linkElm) {
|
||||
editor.insertContent(
|
||||
'<img src="' + linkElm.getAttribute('data-mce-url') + '" alt="' + linkElm.getAttribute('data-mce-alt') + '" />'
|
||||
);
|
||||
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: 'Emoticons'
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/emoticons/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("emoticons",function(a,b){function c(){var a;return a='<table role="list" class="mce-grid">',tinymce.each(d,function(c){a+="<tr>",tinymce.each(c,function(c){var d=b+"/img/smiley-"+c+".gif";a+='<td><a href="#" data-mce-url="'+d+'" data-mce-alt="'+c+'" tabindex="-1" role="option" aria-label="'+c+'"><img src="'+d+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),a+="</tr>"}),a+="</table>"}var d=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];a.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:c,onclick:function(b){var c=a.dom.getParent(b.target,"a");c&&(a.insertContent('<img src="'+c.getAttribute("data-mce-url")+'" alt="'+c.getAttribute("data-mce-alt")+'" />'),this.hide())}},tooltip:"Emoticons"})});
|
||||
490
assets/dashboard/plugins/tinymce/plugins/fullpage/plugin.js
Normal file
@@ -0,0 +1,490 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('fullpage', function(editor) {
|
||||
var each = tinymce.each, Node = tinymce.html.Node;
|
||||
var head, foot;
|
||||
|
||||
function showDialog() {
|
||||
var data = htmlToData();
|
||||
|
||||
editor.windowManager.open({
|
||||
title: 'Document properties',
|
||||
data: data,
|
||||
defaults: {type: 'textbox', size: 40},
|
||||
body: [
|
||||
{name: 'title', label: 'Title'},
|
||||
{name: 'keywords', label: 'Keywords'},
|
||||
{name: 'description', label: 'Description'},
|
||||
{name: 'robots', label: 'Robots'},
|
||||
{name: 'author', label: 'Author'},
|
||||
{name: 'docencoding', label: 'Encoding'}
|
||||
],
|
||||
onSubmit: function(e) {
|
||||
dataToHtml(tinymce.extend(data, e.data));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function htmlToData() {
|
||||
var headerFragment = parseHeader(), data = {}, elm, matches;
|
||||
|
||||
function getAttr(elm, name) {
|
||||
var value = elm.attr(name);
|
||||
|
||||
return value || '';
|
||||
}
|
||||
|
||||
// Default some values
|
||||
data.fontface = editor.getParam("fullpage_default_fontface", "");
|
||||
data.fontsize = editor.getParam("fullpage_default_fontsize", "");
|
||||
|
||||
// Parse XML PI
|
||||
elm = headerFragment.firstChild;
|
||||
if (elm.type == 7) {
|
||||
data.xml_pi = true;
|
||||
matches = /encoding="([^"]+)"/.exec(elm.value);
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Parse doctype
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
if (elm) {
|
||||
data.doctype = '<!DOCTYPE' + elm.value + ">";
|
||||
}
|
||||
|
||||
// Parse title element
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
if (elm && elm.firstChild) {
|
||||
data.title = elm.firstChild.value;
|
||||
}
|
||||
|
||||
// Parse meta elements
|
||||
each(headerFragment.getAll('meta'), function(meta) {
|
||||
var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;
|
||||
|
||||
if (name) {
|
||||
data[name.toLowerCase()] = meta.attr('content');
|
||||
} else if (httpEquiv == "Content-Type") {
|
||||
matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
|
||||
|
||||
if (matches) {
|
||||
data.docencoding = matches[1];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Parse html attribs
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
if (elm) {
|
||||
data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
|
||||
}
|
||||
|
||||
// Parse stylesheets
|
||||
data.stylesheets = [];
|
||||
tinymce.each(headerFragment.getAll('link'), function(link) {
|
||||
if (link.attr('rel') == 'stylesheet') {
|
||||
data.stylesheets.push(link.attr('href'));
|
||||
}
|
||||
});
|
||||
|
||||
// Parse body parts
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
data.langdir = getAttr(elm, 'dir');
|
||||
data.style = getAttr(elm, 'style');
|
||||
data.visited_color = getAttr(elm, 'vlink');
|
||||
data.link_color = getAttr(elm, 'link');
|
||||
data.active_color = getAttr(elm, 'alink');
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function dataToHtml(data) {
|
||||
var headerFragment, headElement, html, elm, value, dom = editor.dom;
|
||||
|
||||
function setAttr(elm, name, value) {
|
||||
elm.attr(name, value ? value : undefined);
|
||||
}
|
||||
|
||||
function addHeadNode(node) {
|
||||
if (headElement.firstChild) {
|
||||
headElement.insert(node, headElement.firstChild);
|
||||
} else {
|
||||
headElement.append(node);
|
||||
}
|
||||
}
|
||||
|
||||
headerFragment = parseHeader();
|
||||
headElement = headerFragment.getAll('head')[0];
|
||||
if (!headElement) {
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
headElement = new Node('head', 1);
|
||||
|
||||
if (elm.firstChild) {
|
||||
elm.insert(headElement, elm.firstChild, true);
|
||||
} else {
|
||||
elm.append(headElement);
|
||||
}
|
||||
}
|
||||
|
||||
// Add/update/remove XML-PI
|
||||
elm = headerFragment.firstChild;
|
||||
if (data.xml_pi) {
|
||||
value = 'version="1.0"';
|
||||
|
||||
if (data.docencoding) {
|
||||
value += ' encoding="' + data.docencoding + '"';
|
||||
}
|
||||
|
||||
if (elm.type != 7) {
|
||||
elm = new Node('xml', 7);
|
||||
headerFragment.insert(elm, headerFragment.firstChild, true);
|
||||
}
|
||||
|
||||
elm.value = value;
|
||||
} else if (elm && elm.type == 7) {
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
// Add/update/remove doctype
|
||||
elm = headerFragment.getAll('#doctype')[0];
|
||||
if (data.doctype) {
|
||||
if (!elm) {
|
||||
elm = new Node('#doctype', 10);
|
||||
|
||||
if (data.xml_pi) {
|
||||
headerFragment.insert(elm, headerFragment.firstChild);
|
||||
} else {
|
||||
addHeadNode(elm);
|
||||
}
|
||||
}
|
||||
|
||||
elm.value = data.doctype.substring(9, data.doctype.length - 1);
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
// Add meta encoding
|
||||
elm = null;
|
||||
each(headerFragment.getAll('meta'), function(meta) {
|
||||
if (meta.attr('http-equiv') == 'Content-Type') {
|
||||
elm = meta;
|
||||
}
|
||||
});
|
||||
|
||||
if (data.docencoding) {
|
||||
if (!elm) {
|
||||
elm = new Node('meta', 1);
|
||||
elm.attr('http-equiv', 'Content-Type');
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
|
||||
elm.attr('content', 'text/html; charset=' + data.docencoding);
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
// Add/update/remove title
|
||||
elm = headerFragment.getAll('title')[0];
|
||||
if (data.title) {
|
||||
if (!elm) {
|
||||
elm = new Node('title', 1);
|
||||
addHeadNode(elm);
|
||||
} else {
|
||||
elm.empty();
|
||||
}
|
||||
|
||||
elm.append(new Node('#text', 3)).value = data.title;
|
||||
} else if (elm) {
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
// Add/update/remove meta
|
||||
each('keywords,description,author,copyright,robots'.split(','), function(name) {
|
||||
var nodes = headerFragment.getAll('meta'), i, meta, value = data[name];
|
||||
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
meta = nodes[i];
|
||||
|
||||
if (meta.attr('name') == name) {
|
||||
if (value) {
|
||||
meta.attr('content', value);
|
||||
} else {
|
||||
meta.remove();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (value) {
|
||||
elm = new Node('meta', 1);
|
||||
elm.attr('name', name);
|
||||
elm.attr('content', value);
|
||||
elm.shortEnded = true;
|
||||
|
||||
addHeadNode(elm);
|
||||
}
|
||||
});
|
||||
|
||||
var currentStyleSheetsMap = {};
|
||||
tinymce.each(headerFragment.getAll('link'), function(stylesheet) {
|
||||
if (stylesheet.attr('rel') == 'stylesheet') {
|
||||
currentStyleSheetsMap[stylesheet.attr('href')] = stylesheet;
|
||||
}
|
||||
});
|
||||
|
||||
// Add new
|
||||
tinymce.each(data.stylesheets, function(stylesheet) {
|
||||
if (!currentStyleSheetsMap[stylesheet]) {
|
||||
elm = new Node('link', 1);
|
||||
elm.attr({
|
||||
rel: 'stylesheet',
|
||||
text: 'text/css',
|
||||
href: stylesheet
|
||||
});
|
||||
elm.shortEnded = true;
|
||||
addHeadNode(elm);
|
||||
}
|
||||
|
||||
delete currentStyleSheetsMap[stylesheet];
|
||||
});
|
||||
|
||||
// Delete old
|
||||
tinymce.each(currentStyleSheetsMap, function(stylesheet) {
|
||||
stylesheet.remove();
|
||||
});
|
||||
|
||||
// Update body attributes
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
setAttr(elm, 'dir', data.langdir);
|
||||
setAttr(elm, 'style', data.style);
|
||||
setAttr(elm, 'vlink', data.visited_color);
|
||||
setAttr(elm, 'link', data.link_color);
|
||||
setAttr(elm, 'alink', data.active_color);
|
||||
|
||||
// Update iframe body as well
|
||||
dom.setAttribs(editor.getBody(), {
|
||||
style: data.style,
|
||||
dir: data.dir,
|
||||
vLink: data.visited_color,
|
||||
link: data.link_color,
|
||||
aLink: data.active_color
|
||||
});
|
||||
}
|
||||
|
||||
// Set html attributes
|
||||
elm = headerFragment.getAll('html')[0];
|
||||
if (elm) {
|
||||
setAttr(elm, 'lang', data.langcode);
|
||||
setAttr(elm, 'xml:lang', data.langcode);
|
||||
}
|
||||
|
||||
// No need for a head element
|
||||
if (!headElement.firstChild) {
|
||||
headElement.remove();
|
||||
}
|
||||
|
||||
// Serialize header fragment and crop away body part
|
||||
html = new tinymce.html.Serializer({
|
||||
validate: false,
|
||||
indent: true,
|
||||
apply_source_formatting: true,
|
||||
indent_before: 'head,html,body,meta,title,script,link,style',
|
||||
indent_after: 'head,html,body,meta,title,script,link,style'
|
||||
}).serialize(headerFragment);
|
||||
|
||||
head = html.substring(0, html.indexOf('</body>'));
|
||||
}
|
||||
|
||||
function parseHeader() {
|
||||
// Parse the contents with a DOM parser
|
||||
return new tinymce.html.DomParser({
|
||||
validate: false,
|
||||
root_name: '#document'
|
||||
}).parse(head);
|
||||
}
|
||||
|
||||
function setContent(evt) {
|
||||
var startPos, endPos, content = evt.content, headerFragment, styles = '', dom = editor.dom, elm;
|
||||
|
||||
if (evt.selection) {
|
||||
return;
|
||||
}
|
||||
|
||||
function low(s) {
|
||||
return s.replace(/<\/?[A-Z]+/g, function(a) {
|
||||
return a.toLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
// Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate
|
||||
if (evt.format == 'raw' && head) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.source_view && editor.getParam('fullpage_hide_in_source_view')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fixed so new document/setContent('') doesn't remove existing header/footer except when it's in source code view
|
||||
if (content.length === 0 && !evt.source_view) {
|
||||
content = tinymce.trim(head) + '\n' + tinymce.trim(content) + '\n' + tinymce.trim(foot);
|
||||
}
|
||||
|
||||
// Parse out head, body and footer
|
||||
content = content.replace(/<(\/?)BODY/gi, '<$1body');
|
||||
startPos = content.indexOf('<body');
|
||||
|
||||
if (startPos != -1) {
|
||||
startPos = content.indexOf('>', startPos);
|
||||
head = low(content.substring(0, startPos + 1));
|
||||
|
||||
endPos = content.indexOf('</body', startPos);
|
||||
if (endPos == -1) {
|
||||
endPos = content.length;
|
||||
}
|
||||
|
||||
evt.content = content.substring(startPos + 1, endPos);
|
||||
foot = low(content.substring(endPos));
|
||||
} else {
|
||||
head = getDefaultHeader();
|
||||
foot = '\n</body>\n</html>';
|
||||
}
|
||||
|
||||
// Parse header and update iframe
|
||||
headerFragment = parseHeader();
|
||||
each(headerFragment.getAll('style'), function(node) {
|
||||
if (node.firstChild) {
|
||||
styles += node.firstChild.value;
|
||||
}
|
||||
});
|
||||
|
||||
elm = headerFragment.getAll('body')[0];
|
||||
if (elm) {
|
||||
dom.setAttribs(editor.getBody(), {
|
||||
style: elm.attr('style') || '',
|
||||
dir: elm.attr('dir') || '',
|
||||
vLink: elm.attr('vlink') || '',
|
||||
link: elm.attr('link') || '',
|
||||
aLink: elm.attr('alink') || ''
|
||||
});
|
||||
}
|
||||
|
||||
dom.remove('fullpage_styles');
|
||||
|
||||
var headElm = editor.getDoc().getElementsByTagName('head')[0];
|
||||
|
||||
if (styles) {
|
||||
dom.add(headElm, 'style', {
|
||||
id: 'fullpage_styles'
|
||||
}, styles);
|
||||
|
||||
// Needed for IE 6/7
|
||||
elm = dom.get('fullpage_styles');
|
||||
if (elm.styleSheet) {
|
||||
elm.styleSheet.cssText = styles;
|
||||
}
|
||||
}
|
||||
|
||||
var currentStyleSheetsMap = {};
|
||||
tinymce.each(headElm.getElementsByTagName('link'), function(stylesheet) {
|
||||
if (stylesheet.rel == 'stylesheet' && stylesheet.getAttribute('data-mce-fullpage')) {
|
||||
currentStyleSheetsMap[stylesheet.href] = stylesheet;
|
||||
}
|
||||
});
|
||||
|
||||
// Add new
|
||||
tinymce.each(headerFragment.getAll('link'), function(stylesheet) {
|
||||
var href = stylesheet.attr('href');
|
||||
|
||||
if (!currentStyleSheetsMap[href] && stylesheet.attr('rel') == 'stylesheet') {
|
||||
dom.add(headElm, 'link', {
|
||||
rel: 'stylesheet',
|
||||
text: 'text/css',
|
||||
href: href,
|
||||
'data-mce-fullpage': '1'
|
||||
});
|
||||
}
|
||||
|
||||
delete currentStyleSheetsMap[href];
|
||||
});
|
||||
|
||||
// Delete old
|
||||
tinymce.each(currentStyleSheetsMap, function(stylesheet) {
|
||||
stylesheet.parentNode.removeChild(stylesheet);
|
||||
});
|
||||
}
|
||||
|
||||
function getDefaultHeader() {
|
||||
var header = '', value, styles = '';
|
||||
|
||||
if (editor.getParam('fullpage_default_xml_pi')) {
|
||||
header += '<?xml version="1.0" encoding="' + editor.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
|
||||
}
|
||||
|
||||
header += editor.getParam('fullpage_default_doctype', '<!DOCTYPE html>');
|
||||
header += '\n<html>\n<head>\n';
|
||||
|
||||
if ((value = editor.getParam('fullpage_default_title'))) {
|
||||
header += '<title>' + value + '</title>\n';
|
||||
}
|
||||
|
||||
if ((value = editor.getParam('fullpage_default_encoding'))) {
|
||||
header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
|
||||
}
|
||||
|
||||
if ((value = editor.getParam('fullpage_default_font_family'))) {
|
||||
styles += 'font-family: ' + value + ';';
|
||||
}
|
||||
|
||||
if ((value = editor.getParam('fullpage_default_font_size'))) {
|
||||
styles += 'font-size: ' + value + ';';
|
||||
}
|
||||
|
||||
if ((value = editor.getParam('fullpage_default_text_color'))) {
|
||||
styles += 'color: ' + value + ';';
|
||||
}
|
||||
|
||||
header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
function getContent(evt) {
|
||||
if (!evt.selection && (!evt.source_view || !editor.getParam('fullpage_hide_in_source_view'))) {
|
||||
evt.content = tinymce.trim(head) + '\n' + tinymce.trim(evt.content) + '\n' + tinymce.trim(foot);
|
||||
}
|
||||
}
|
||||
|
||||
editor.addCommand('mceFullPageProperties', showDialog);
|
||||
|
||||
editor.addButton('fullpage', {
|
||||
title: 'Document properties',
|
||||
cmd: 'mceFullPageProperties'
|
||||
});
|
||||
|
||||
editor.addMenuItem('fullpage', {
|
||||
text: 'Document properties',
|
||||
cmd: 'mceFullPageProperties',
|
||||
context: 'file'
|
||||
});
|
||||
|
||||
editor.on('BeforeSetContent', setContent);
|
||||
editor.on('GetContent', getContent);
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/fullpage/plugin.min.js
vendored
Normal file
154
assets/dashboard/plugins/tinymce/plugins/fullscreen/plugin.js
Normal file
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('fullscreen', function(editor) {
|
||||
var fullscreenState = false, DOM = tinymce.DOM, iframeWidth, iframeHeight, resizeHandler;
|
||||
var containerWidth, containerHeight, scrollPos;
|
||||
|
||||
if (editor.settings.inline) {
|
||||
return;
|
||||
}
|
||||
|
||||
function getWindowSize() {
|
||||
var w, h, win = window, doc = document;
|
||||
var body = doc.body;
|
||||
|
||||
// Old IE
|
||||
if (body.offsetWidth) {
|
||||
w = body.offsetWidth;
|
||||
h = body.offsetHeight;
|
||||
}
|
||||
|
||||
// Modern browsers
|
||||
if (win.innerWidth && win.innerHeight) {
|
||||
w = win.innerWidth;
|
||||
h = win.innerHeight;
|
||||
}
|
||||
|
||||
return {w: w, h: h};
|
||||
}
|
||||
|
||||
function getScrollPos() {
|
||||
var vp = tinymce.DOM.getViewPort();
|
||||
|
||||
return {
|
||||
x: vp.x,
|
||||
y: vp.y
|
||||
};
|
||||
}
|
||||
|
||||
function setScrollPos(pos) {
|
||||
scrollTo(pos.x, pos.y);
|
||||
}
|
||||
|
||||
function toggleFullscreen() {
|
||||
var body = document.body, documentElement = document.documentElement, editorContainerStyle;
|
||||
var editorContainer, iframe, iframeStyle;
|
||||
|
||||
function resize() {
|
||||
DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
|
||||
}
|
||||
|
||||
fullscreenState = !fullscreenState;
|
||||
|
||||
editorContainer = editor.getContainer();
|
||||
editorContainerStyle = editorContainer.style;
|
||||
iframe = editor.getContentAreaContainer().firstChild;
|
||||
iframeStyle = iframe.style;
|
||||
|
||||
if (fullscreenState) {
|
||||
scrollPos = getScrollPos();
|
||||
iframeWidth = iframeStyle.width;
|
||||
iframeHeight = iframeStyle.height;
|
||||
iframeStyle.width = iframeStyle.height = '100%';
|
||||
containerWidth = editorContainerStyle.width;
|
||||
containerHeight = editorContainerStyle.height;
|
||||
editorContainerStyle.width = editorContainerStyle.height = '';
|
||||
|
||||
DOM.addClass(body, 'mce-fullscreen');
|
||||
DOM.addClass(documentElement, 'mce-fullscreen');
|
||||
DOM.addClass(editorContainer, 'mce-fullscreen');
|
||||
|
||||
DOM.bind(window, 'resize', resize);
|
||||
resize();
|
||||
resizeHandler = resize;
|
||||
} else {
|
||||
iframeStyle.width = iframeWidth;
|
||||
iframeStyle.height = iframeHeight;
|
||||
|
||||
if (containerWidth) {
|
||||
editorContainerStyle.width = containerWidth;
|
||||
}
|
||||
|
||||
if (containerHeight) {
|
||||
editorContainerStyle.height = containerHeight;
|
||||
}
|
||||
|
||||
DOM.removeClass(body, 'mce-fullscreen');
|
||||
DOM.removeClass(documentElement, 'mce-fullscreen');
|
||||
DOM.removeClass(editorContainer, 'mce-fullscreen');
|
||||
DOM.unbind(window, 'resize', resizeHandler);
|
||||
setScrollPos(scrollPos);
|
||||
}
|
||||
|
||||
editor.fire('FullscreenStateChanged', {state: fullscreenState});
|
||||
}
|
||||
|
||||
editor.on('init', function() {
|
||||
editor.addShortcut('Ctrl+Shift+F', '', toggleFullscreen);
|
||||
});
|
||||
|
||||
editor.on('remove', function() {
|
||||
if (resizeHandler) {
|
||||
DOM.unbind(window, 'resize', resizeHandler);
|
||||
}
|
||||
});
|
||||
|
||||
editor.addCommand('mceFullScreen', toggleFullscreen);
|
||||
|
||||
editor.addMenuItem('fullscreen', {
|
||||
text: 'Fullscreen',
|
||||
shortcut: 'Ctrl+Shift+F',
|
||||
selectable: true,
|
||||
onClick: function() {
|
||||
toggleFullscreen();
|
||||
editor.focus();
|
||||
},
|
||||
onPostRender: function() {
|
||||
var self = this;
|
||||
|
||||
editor.on('FullscreenStateChanged', function(e) {
|
||||
self.active(e.state);
|
||||
});
|
||||
},
|
||||
context: 'view'
|
||||
});
|
||||
|
||||
editor.addButton('fullscreen', {
|
||||
tooltip: 'Fullscreen',
|
||||
shortcut: 'Ctrl+Alt+F',
|
||||
onClick: toggleFullscreen,
|
||||
onPostRender: function() {
|
||||
var self = this;
|
||||
|
||||
editor.on('FullscreenStateChanged', function(e) {
|
||||
self.active(e.state);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
isFullscreen: function() {
|
||||
return fullscreenState;
|
||||
}
|
||||
};
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/fullscreen/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){var a=tinymce.DOM.getViewPort();return{x:a.x,y:a.y}}function d(a){scrollTo(a.x,a.y)}function e(){function e(){m.setStyle(p,"height",b().h-(o.clientHeight-p.clientHeight))}var n,o,p,q,r=document.body,s=document.documentElement;l=!l,o=a.getContainer(),n=o.style,p=a.getContentAreaContainer().firstChild,q=p.style,l?(k=c(),f=q.width,g=q.height,q.width=q.height="100%",i=n.width,j=n.height,n.width=n.height="",m.addClass(r,"mce-fullscreen"),m.addClass(s,"mce-fullscreen"),m.addClass(o,"mce-fullscreen"),m.bind(window,"resize",e),e(),h=e):(q.width=f,q.height=g,i&&(n.width=i),j&&(n.height=j),m.removeClass(r,"mce-fullscreen"),m.removeClass(s,"mce-fullscreen"),m.removeClass(o,"mce-fullscreen"),m.unbind(window,"resize",h),d(k)),a.fire("FullscreenStateChanged",{state:l})}var f,g,h,i,j,k,l=!1,m=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Ctrl+Shift+F","",e)}),a.on("remove",function(){h&&m.unbind(window,"resize",h)}),a.addCommand("mceFullScreen",e),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onClick:function(){e(),a.focus()},onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Alt+F",onClick:e,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return l}})});
|
||||
30
assets/dashboard/plugins/tinymce/plugins/hr/plugin.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('hr', function(editor) {
|
||||
editor.addCommand('InsertHorizontalRule', function() {
|
||||
editor.execCommand('mceInsertContent', false, '<hr />');
|
||||
});
|
||||
|
||||
editor.addButton('hr', {
|
||||
icon: 'hr',
|
||||
tooltip: 'Horizontal line',
|
||||
cmd: 'InsertHorizontalRule'
|
||||
});
|
||||
|
||||
editor.addMenuItem('hr', {
|
||||
icon: 'hr',
|
||||
text: 'Horizontal line',
|
||||
cmd: 'InsertHorizontalRule',
|
||||
context: 'insert'
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/hr/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"<hr />")}),a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})});
|
||||
630
assets/dashboard/plugins/tinymce/plugins/image/plugin.js
Normal file
@@ -0,0 +1,630 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('image', function(editor) {
|
||||
function getImageSize(url, callback) {
|
||||
var img = document.createElement('img');
|
||||
|
||||
function done(width, height) {
|
||||
if (img.parentNode) {
|
||||
img.parentNode.removeChild(img);
|
||||
}
|
||||
|
||||
callback({width: width, height: height});
|
||||
}
|
||||
|
||||
img.onload = function() {
|
||||
done(Math.max(img.width, img.clientWidth), Math.max(img.height, img.clientHeight));
|
||||
};
|
||||
|
||||
img.onerror = function() {
|
||||
done();
|
||||
};
|
||||
|
||||
var style = img.style;
|
||||
style.visibility = 'hidden';
|
||||
style.position = 'fixed';
|
||||
style.bottom = style.left = 0;
|
||||
style.width = style.height = 'auto';
|
||||
|
||||
document.body.appendChild(img);
|
||||
img.src = url;
|
||||
}
|
||||
|
||||
function buildListItems(inputList, itemCallback, startItems) {
|
||||
function appendItems(values, output) {
|
||||
output = output || [];
|
||||
|
||||
tinymce.each(values, function(item) {
|
||||
var menuItem = {text: item.text || item.title};
|
||||
|
||||
if (item.menu) {
|
||||
menuItem.menu = appendItems(item.menu);
|
||||
} else {
|
||||
menuItem.value = item.value;
|
||||
itemCallback(menuItem);
|
||||
}
|
||||
|
||||
output.push(menuItem);
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
return appendItems(inputList, startItems || []);
|
||||
}
|
||||
|
||||
function createImageList(callback) {
|
||||
return function() {
|
||||
var imageList = editor.settings.image_list;
|
||||
|
||||
if (typeof imageList == "string") {
|
||||
tinymce.util.XHR.send({
|
||||
url: imageList,
|
||||
success: function(text) {
|
||||
callback(tinymce.util.JSON.parse(text));
|
||||
}
|
||||
});
|
||||
} else if (typeof imageList == "function") {
|
||||
imageList(callback);
|
||||
} else {
|
||||
callback(imageList);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function showDialog(imageList) {
|
||||
var win, data = {}, dom = editor.dom, imgElm, figureElm;
|
||||
var width, height, imageListCtrl, classListCtrl, imageDimensions = editor.settings.image_dimensions !== false;
|
||||
|
||||
function recalcSize() {
|
||||
var widthCtrl, heightCtrl, newWidth, newHeight;
|
||||
|
||||
widthCtrl = win.find('#width')[0];
|
||||
heightCtrl = win.find('#height')[0];
|
||||
|
||||
if (!widthCtrl || !heightCtrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
newWidth = widthCtrl.value();
|
||||
newHeight = heightCtrl.value();
|
||||
|
||||
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
|
||||
if (width != newWidth) {
|
||||
newHeight = Math.round((newWidth / width) * newHeight);
|
||||
|
||||
if (!isNaN(newHeight)) {
|
||||
heightCtrl.value(newHeight);
|
||||
}
|
||||
} else {
|
||||
newWidth = Math.round((newHeight / height) * newWidth);
|
||||
|
||||
if (!isNaN(newWidth)) {
|
||||
widthCtrl.value(newWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
}
|
||||
|
||||
function onSubmitForm() {
|
||||
var figureElm, oldImg;
|
||||
|
||||
function waitLoad(imgElm) {
|
||||
function selectImage() {
|
||||
imgElm.onload = imgElm.onerror = null;
|
||||
|
||||
if (editor.selection) {
|
||||
editor.selection.select(imgElm);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
imgElm.onload = function() {
|
||||
if (!data.width && !data.height && imageDimensions) {
|
||||
dom.setAttribs(imgElm, {
|
||||
width: imgElm.clientWidth,
|
||||
height: imgElm.clientHeight
|
||||
});
|
||||
}
|
||||
|
||||
selectImage();
|
||||
};
|
||||
|
||||
imgElm.onerror = selectImage;
|
||||
}
|
||||
|
||||
updateStyle();
|
||||
recalcSize();
|
||||
|
||||
data = tinymce.extend(data, win.toJSON());
|
||||
|
||||
if (!data.alt) {
|
||||
data.alt = '';
|
||||
}
|
||||
|
||||
if (!data.title) {
|
||||
data.title = '';
|
||||
}
|
||||
|
||||
if (data.width === '') {
|
||||
data.width = null;
|
||||
}
|
||||
|
||||
if (data.height === '') {
|
||||
data.height = null;
|
||||
}
|
||||
|
||||
if (!data.style) {
|
||||
data.style = null;
|
||||
}
|
||||
|
||||
// Setup new data excluding style properties
|
||||
/*eslint dot-notation: 0*/
|
||||
data = {
|
||||
src: data.src,
|
||||
alt: data.alt,
|
||||
title: data.title,
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
style: data.style,
|
||||
caption: data.caption,
|
||||
"class": data["class"]
|
||||
};
|
||||
|
||||
editor.undoManager.transact(function() {
|
||||
if (!data.src) {
|
||||
if (imgElm) {
|
||||
dom.remove(imgElm);
|
||||
editor.focus();
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.title === "") {
|
||||
data.title = null;
|
||||
}
|
||||
|
||||
if (!imgElm) {
|
||||
data.id = '__mcenew';
|
||||
editor.focus();
|
||||
editor.selection.setContent(dom.createHTML('img', data));
|
||||
imgElm = dom.get('__mcenew');
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
} else {
|
||||
dom.setAttribs(imgElm, data);
|
||||
}
|
||||
|
||||
editor.editorUpload.uploadImagesAuto();
|
||||
|
||||
if (data.caption === false) {
|
||||
if (dom.is(imgElm.parentNode, 'figure.image')) {
|
||||
figureElm = imgElm.parentNode;
|
||||
dom.insertAfter(imgElm, figureElm);
|
||||
dom.remove(figureElm);
|
||||
}
|
||||
}
|
||||
|
||||
function isTextBlock(node) {
|
||||
return editor.schema.getTextBlockElements()[node.nodeName];
|
||||
}
|
||||
|
||||
if (data.caption === true) {
|
||||
if (!dom.is(imgElm.parentNode, 'figure.image')) {
|
||||
oldImg = imgElm;
|
||||
imgElm = imgElm.cloneNode(true);
|
||||
figureElm = dom.create('figure', {'class': 'image'});
|
||||
figureElm.appendChild(imgElm);
|
||||
figureElm.appendChild(dom.create('figcaption', {contentEditable: true}, 'Caption'));
|
||||
figureElm.contentEditable = false;
|
||||
|
||||
var textBlock = dom.getParent(oldImg, isTextBlock);
|
||||
if (textBlock) {
|
||||
dom.split(textBlock, oldImg, figureElm);
|
||||
} else {
|
||||
dom.replace(figureElm, oldImg);
|
||||
}
|
||||
|
||||
editor.selection.select(figureElm);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
waitLoad(imgElm);
|
||||
});
|
||||
}
|
||||
|
||||
function removePixelSuffix(value) {
|
||||
if (value) {
|
||||
value = value.replace(/px$/, '');
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function srcChange(e) {
|
||||
var srcURL, prependURL, absoluteURLPattern, meta = e.meta || {};
|
||||
|
||||
if (imageListCtrl) {
|
||||
imageListCtrl.value(editor.convertURL(this.value(), 'src'));
|
||||
}
|
||||
|
||||
tinymce.each(meta, function(value, key) {
|
||||
win.find('#' + key).value(value);
|
||||
});
|
||||
|
||||
if (!meta.width && !meta.height) {
|
||||
srcURL = editor.convertURL(this.value(), 'src');
|
||||
|
||||
// Pattern test the src url and make sure we haven't already prepended the url
|
||||
prependURL = editor.settings.image_prepend_url;
|
||||
absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i');
|
||||
if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) {
|
||||
srcURL = prependURL + srcURL;
|
||||
}
|
||||
|
||||
this.value(srcURL);
|
||||
|
||||
getImageSize(editor.documentBaseURI.toAbsolute(this.value()), function(data) {
|
||||
if (data.width && data.height && imageDimensions) {
|
||||
width = data.width;
|
||||
height = data.height;
|
||||
|
||||
win.find('#width').value(width);
|
||||
win.find('#height').value(height);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
imgElm = editor.selection.getNode();
|
||||
figureElm = dom.getParent(imgElm, 'figure.image');
|
||||
if (figureElm) {
|
||||
imgElm = dom.select('img', figureElm)[0];
|
||||
}
|
||||
|
||||
if (imgElm && (imgElm.nodeName != 'IMG' || imgElm.getAttribute('data-mce-object') || imgElm.getAttribute('data-mce-placeholder'))) {
|
||||
imgElm = null;
|
||||
}
|
||||
|
||||
if (imgElm) {
|
||||
width = dom.getAttrib(imgElm, 'width');
|
||||
height = dom.getAttrib(imgElm, 'height');
|
||||
|
||||
data = {
|
||||
src: dom.getAttrib(imgElm, 'src'),
|
||||
alt: dom.getAttrib(imgElm, 'alt'),
|
||||
title: dom.getAttrib(imgElm, 'title'),
|
||||
"class": dom.getAttrib(imgElm, 'class'),
|
||||
width: width,
|
||||
height: height,
|
||||
caption: !!figureElm
|
||||
};
|
||||
}
|
||||
|
||||
if (imageList) {
|
||||
imageListCtrl = {
|
||||
type: 'listbox',
|
||||
label: 'Image list',
|
||||
values: buildListItems(
|
||||
imageList,
|
||||
function(item) {
|
||||
item.value = editor.convertURL(item.value || item.url, 'src');
|
||||
},
|
||||
[{text: 'None', value: ''}]
|
||||
),
|
||||
value: data.src && editor.convertURL(data.src, 'src'),
|
||||
onselect: function(e) {
|
||||
var altCtrl = win.find('#alt');
|
||||
|
||||
if (!altCtrl.value() || (e.lastControl && altCtrl.value() == e.lastControl.text())) {
|
||||
altCtrl.value(e.control.text());
|
||||
}
|
||||
|
||||
win.find('#src').value(e.control.value()).fire('change');
|
||||
},
|
||||
onPostRender: function() {
|
||||
/*eslint consistent-this: 0*/
|
||||
imageListCtrl = this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (editor.settings.image_class_list) {
|
||||
classListCtrl = {
|
||||
name: 'class',
|
||||
type: 'listbox',
|
||||
label: 'Class',
|
||||
values: buildListItems(
|
||||
editor.settings.image_class_list,
|
||||
function(item) {
|
||||
if (item.value) {
|
||||
item.textStyle = function() {
|
||||
return editor.formatter.getCssText({inline: 'img', classes: [item.value]});
|
||||
};
|
||||
}
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
// General settings shared between simple and advanced dialogs
|
||||
var generalFormItems = [
|
||||
{
|
||||
name: 'src',
|
||||
type: 'filepicker',
|
||||
filetype: 'image',
|
||||
label: 'Source',
|
||||
autofocus: true,
|
||||
onchange: srcChange
|
||||
},
|
||||
imageListCtrl
|
||||
];
|
||||
|
||||
if (editor.settings.image_description !== false) {
|
||||
generalFormItems.push({name: 'alt', type: 'textbox', label: 'Image description'});
|
||||
}
|
||||
|
||||
if (editor.settings.image_title) {
|
||||
generalFormItems.push({name: 'title', type: 'textbox', label: 'Image Title'});
|
||||
}
|
||||
|
||||
if (imageDimensions) {
|
||||
generalFormItems.push({
|
||||
type: 'container',
|
||||
label: 'Dimensions',
|
||||
layout: 'flex',
|
||||
direction: 'row',
|
||||
align: 'center',
|
||||
spacing: 5,
|
||||
items: [
|
||||
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width'},
|
||||
{type: 'label', text: 'x'},
|
||||
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height'},
|
||||
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
generalFormItems.push(classListCtrl);
|
||||
|
||||
if (editor.settings.image_caption && tinymce.Env.ceFalse) {
|
||||
generalFormItems.push({name: 'caption', type: 'checkbox', label: 'Caption'});
|
||||
}
|
||||
|
||||
function mergeMargins(css) {
|
||||
if (css.margin) {
|
||||
|
||||
var splitMargin = css.margin.split(" ");
|
||||
|
||||
switch (splitMargin.length) {
|
||||
case 1: //margin: toprightbottomleft;
|
||||
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
||||
css['margin-right'] = css['margin-right'] || splitMargin[0];
|
||||
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
||||
css['margin-left'] = css['margin-left'] || splitMargin[0];
|
||||
break;
|
||||
case 2: //margin: topbottom rightleft;
|
||||
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
||||
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
||||
css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
|
||||
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
||||
break;
|
||||
case 3: //margin: top rightleft bottom;
|
||||
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
||||
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
||||
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
||||
css['margin-left'] = css['margin-left'] || splitMargin[1];
|
||||
break;
|
||||
case 4: //margin: top right bottom left;
|
||||
css['margin-top'] = css['margin-top'] || splitMargin[0];
|
||||
css['margin-right'] = css['margin-right'] || splitMargin[1];
|
||||
css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
|
||||
css['margin-left'] = css['margin-left'] || splitMargin[3];
|
||||
}
|
||||
delete css.margin;
|
||||
}
|
||||
return css;
|
||||
}
|
||||
|
||||
function updateStyle() {
|
||||
function addPixelSuffix(value) {
|
||||
if (value.length > 0 && /^[0-9]+$/.test(value)) {
|
||||
value += 'px';
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
if (!editor.settings.image_advtab) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = win.toJSON(),
|
||||
css = dom.parseStyle(data.style);
|
||||
|
||||
css = mergeMargins(css);
|
||||
|
||||
if (data.vspace) {
|
||||
css['margin-top'] = css['margin-bottom'] = addPixelSuffix(data.vspace);
|
||||
}
|
||||
if (data.hspace) {
|
||||
css['margin-left'] = css['margin-right'] = addPixelSuffix(data.hspace);
|
||||
}
|
||||
if (data.border) {
|
||||
css['border-width'] = addPixelSuffix(data.border);
|
||||
}
|
||||
|
||||
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
||||
}
|
||||
|
||||
function updateVSpaceHSpaceBorder() {
|
||||
if (!editor.settings.image_advtab) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = win.toJSON(),
|
||||
css = dom.parseStyle(data.style);
|
||||
|
||||
win.find('#vspace').value("");
|
||||
win.find('#hspace').value("");
|
||||
|
||||
css = mergeMargins(css);
|
||||
|
||||
//Move opposite equal margins to vspace/hspace field
|
||||
if ((css['margin-top'] && css['margin-bottom']) || (css['margin-right'] && css['margin-left'])) {
|
||||
if (css['margin-top'] === css['margin-bottom']) {
|
||||
win.find('#vspace').value(removePixelSuffix(css['margin-top']));
|
||||
} else {
|
||||
win.find('#vspace').value('');
|
||||
}
|
||||
if (css['margin-right'] === css['margin-left']) {
|
||||
win.find('#hspace').value(removePixelSuffix(css['margin-right']));
|
||||
} else {
|
||||
win.find('#hspace').value('');
|
||||
}
|
||||
}
|
||||
|
||||
//Move border-width
|
||||
if (css['border-width']) {
|
||||
win.find('#border').value(removePixelSuffix(css['border-width']));
|
||||
}
|
||||
|
||||
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
||||
|
||||
}
|
||||
|
||||
if (editor.settings.image_advtab) {
|
||||
// Parse styles from img
|
||||
if (imgElm) {
|
||||
if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) {
|
||||
data.hspace = removePixelSuffix(imgElm.style.marginLeft);
|
||||
}
|
||||
if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) {
|
||||
data.vspace = removePixelSuffix(imgElm.style.marginTop);
|
||||
}
|
||||
if (imgElm.style.borderWidth) {
|
||||
data.border = removePixelSuffix(imgElm.style.borderWidth);
|
||||
}
|
||||
|
||||
data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style')));
|
||||
}
|
||||
|
||||
// Advanced dialog shows general+advanced tabs
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert/edit image',
|
||||
data: data,
|
||||
bodyType: 'tabpanel',
|
||||
body: [
|
||||
{
|
||||
title: 'General',
|
||||
type: 'form',
|
||||
items: generalFormItems
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Advanced',
|
||||
type: 'form',
|
||||
pack: 'start',
|
||||
items: [
|
||||
{
|
||||
label: 'Style',
|
||||
name: 'style',
|
||||
type: 'textbox',
|
||||
onchange: updateVSpaceHSpaceBorder
|
||||
},
|
||||
{
|
||||
type: 'form',
|
||||
layout: 'grid',
|
||||
packV: 'start',
|
||||
columns: 2,
|
||||
padding: 0,
|
||||
alignH: ['left', 'right'],
|
||||
defaults: {
|
||||
type: 'textbox',
|
||||
maxWidth: 50,
|
||||
onchange: updateStyle
|
||||
},
|
||||
items: [
|
||||
{label: 'Vertical space', name: 'vspace'},
|
||||
{label: 'Horizontal space', name: 'hspace'},
|
||||
{label: 'Border', name: 'border'}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
onSubmit: onSubmitForm
|
||||
});
|
||||
} else {
|
||||
// Simple default dialog
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert/edit image',
|
||||
data: data,
|
||||
body: generalFormItems,
|
||||
onSubmit: onSubmitForm
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
editor.on('preInit', function() {
|
||||
function hasImageClass(node) {
|
||||
var className = node.attr('class');
|
||||
return className && /\bimage\b/.test(className);
|
||||
}
|
||||
|
||||
function toggleContentEditableState(state) {
|
||||
return function(nodes) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
function toggleContentEditable(node) {
|
||||
node.attr('contenteditable', state ? 'true' : null);
|
||||
}
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
|
||||
if (hasImageClass(node)) {
|
||||
node.attr('contenteditable', state ? 'false' : null);
|
||||
tinymce.each(node.getAll('figcaption'), toggleContentEditable);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
editor.parser.addNodeFilter('figure', toggleContentEditableState(true));
|
||||
editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));
|
||||
});
|
||||
|
||||
editor.addButton('image', {
|
||||
icon: 'image',
|
||||
tooltip: 'Insert/edit image',
|
||||
onclick: createImageList(showDialog),
|
||||
stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image'
|
||||
});
|
||||
|
||||
editor.addMenuItem('image', {
|
||||
icon: 'image',
|
||||
text: 'Insert/edit image',
|
||||
onclick: createImageList(showDialog),
|
||||
context: 'insert',
|
||||
prependToContext: true
|
||||
});
|
||||
|
||||
editor.addCommand('mceImage', createImageList(showDialog));
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/image/plugin.min.js
vendored
Normal file
2944
assets/dashboard/plugins/tinymce/plugins/imagetools/plugin.js
Normal file
1
assets/dashboard/plugins/tinymce/plugins/imagetools/plugin.min.js
vendored
Normal file
227
assets/dashboard/plugins/tinymce/plugins/importcss/plugin.js
Normal file
@@ -0,0 +1,227 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('importcss', function(editor) {
|
||||
var self = this, each = tinymce.each;
|
||||
|
||||
function removeCacheSuffix(url) {
|
||||
var cacheSuffix = tinymce.Env.cacheSuffix;
|
||||
|
||||
if (typeof url == 'string') {
|
||||
url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
function isSkinContentCss(href) {
|
||||
var settings = editor.settings, skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
|
||||
|
||||
if (skin) {
|
||||
var skinUrl = settings.skin_url;
|
||||
|
||||
if (skinUrl) {
|
||||
skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
|
||||
} else {
|
||||
skinUrl = tinymce.baseURL + '/skins/' + skin;
|
||||
}
|
||||
|
||||
return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function compileFilter(filter) {
|
||||
if (typeof filter == "string") {
|
||||
return function(value) {
|
||||
return value.indexOf(filter) !== -1;
|
||||
};
|
||||
} else if (filter instanceof RegExp) {
|
||||
return function(value) {
|
||||
return filter.test(value);
|
||||
};
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
function getSelectors(doc, fileFilter) {
|
||||
var selectors = [], contentCSSUrls = {};
|
||||
|
||||
function append(styleSheet, imported) {
|
||||
var href = styleSheet.href, rules;
|
||||
|
||||
href = removeCacheSuffix(href);
|
||||
|
||||
if (!href || !fileFilter(href, imported) || isSkinContentCss(href)) {
|
||||
return;
|
||||
}
|
||||
|
||||
each(styleSheet.imports, function(styleSheet) {
|
||||
append(styleSheet, true);
|
||||
});
|
||||
|
||||
try {
|
||||
rules = styleSheet.cssRules || styleSheet.rules;
|
||||
} catch (e) {
|
||||
// Firefox fails on rules to remote domain for example:
|
||||
// @import url(//fonts.googleapis.com/css?family=Pathway+Gothic+One);
|
||||
}
|
||||
|
||||
each(rules, function(cssRule) {
|
||||
if (cssRule.styleSheet) {
|
||||
append(cssRule.styleSheet, true);
|
||||
} else if (cssRule.selectorText) {
|
||||
each(cssRule.selectorText.split(','), function(selector) {
|
||||
selectors.push(tinymce.trim(selector));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
each(editor.contentCSS, function(url) {
|
||||
contentCSSUrls[url] = true;
|
||||
});
|
||||
|
||||
if (!fileFilter) {
|
||||
fileFilter = function(href, imported) {
|
||||
return imported || contentCSSUrls[href];
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
each(doc.styleSheets, function(styleSheet) {
|
||||
append(styleSheet);
|
||||
});
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
return selectors;
|
||||
}
|
||||
|
||||
function convertSelectorToFormat(selectorText) {
|
||||
var format;
|
||||
|
||||
// Parse simple element.class1, .class1
|
||||
var selector = /^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(selectorText);
|
||||
if (!selector) {
|
||||
return;
|
||||
}
|
||||
|
||||
var elementName = selector[1];
|
||||
var classes = selector[2].substr(1).split('.').join(' ');
|
||||
var inlineSelectorElements = tinymce.makeMap('a,img');
|
||||
|
||||
// element.class - Produce block formats
|
||||
if (selector[1]) {
|
||||
format = {
|
||||
title: selectorText
|
||||
};
|
||||
|
||||
if (editor.schema.getTextBlockElements()[elementName]) {
|
||||
// Text block format ex: h1.class1
|
||||
format.block = elementName;
|
||||
} else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {
|
||||
// Block elements such as table.class and special inline elements such as a.class or img.class
|
||||
format.selector = elementName;
|
||||
} else {
|
||||
// Inline format strong.class1
|
||||
format.inline = elementName;
|
||||
}
|
||||
} else if (selector[2]) {
|
||||
// .class - Produce inline span with classes
|
||||
format = {
|
||||
inline: 'span',
|
||||
title: selectorText.substr(1),
|
||||
classes: classes
|
||||
};
|
||||
}
|
||||
|
||||
// Append to or override class attribute
|
||||
if (editor.settings.importcss_merge_classes !== false) {
|
||||
format.classes = classes;
|
||||
} else {
|
||||
format.attributes = {"class": classes};
|
||||
}
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
editor.on('renderFormatsMenu', function(e) {
|
||||
var settings = editor.settings, selectors = {};
|
||||
var selectorConverter = settings.importcss_selector_converter || convertSelectorToFormat;
|
||||
var selectorFilter = compileFilter(settings.importcss_selector_filter), ctrl = e.control;
|
||||
|
||||
if (!editor.settings.importcss_append) {
|
||||
ctrl.items().remove();
|
||||
}
|
||||
|
||||
// Setup new groups collection by cloning the configured one
|
||||
var groups = [];
|
||||
tinymce.each(settings.importcss_groups, function(group) {
|
||||
group = tinymce.extend({}, group);
|
||||
group.filter = compileFilter(group.filter);
|
||||
groups.push(group);
|
||||
});
|
||||
|
||||
each(getSelectors(e.doc || editor.getDoc(), compileFilter(settings.importcss_file_filter)), function(selector) {
|
||||
if (selector.indexOf('.mce-') === -1) {
|
||||
if (!selectors[selector] && (!selectorFilter || selectorFilter(selector))) {
|
||||
var format = selectorConverter.call(self, selector), menu;
|
||||
|
||||
if (format) {
|
||||
var formatName = format.name || tinymce.DOM.uniqueId();
|
||||
|
||||
if (groups) {
|
||||
for (var i = 0; i < groups.length; i++) {
|
||||
if (!groups[i].filter || groups[i].filter(selector)) {
|
||||
if (!groups[i].item) {
|
||||
groups[i].item = {text: groups[i].title, menu: []};
|
||||
}
|
||||
|
||||
menu = groups[i].item.menu;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editor.formatter.register(formatName, format);
|
||||
|
||||
var menuItem = tinymce.extend({}, ctrl.settings.itemDefaults, {
|
||||
text: format.title,
|
||||
format: formatName
|
||||
});
|
||||
|
||||
if (menu) {
|
||||
menu.push(menuItem);
|
||||
} else {
|
||||
ctrl.add(menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
selectors[selector] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
each(groups, function(group) {
|
||||
ctrl.add(group.item);
|
||||
});
|
||||
|
||||
e.control.renderNew();
|
||||
});
|
||||
|
||||
// Expose default convertSelectorToFormat implementation
|
||||
self.convertSelectorToFormat = convertSelectorToFormat;
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/importcss/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("importcss",function(a){function b(a){var b=tinymce.Env.cacheSuffix;return"string"==typeof a&&(a=a.replace("?"+b,"").replace("&"+b,"")),a}function c(b){var c=a.settings,d=c.skin!==!1?c.skin||"lightgray":!1;if(d){var e=c.skin_url;return e=e?a.documentBaseURI.toAbsolute(e):tinymce.baseURL+"/skins/"+d,b===e+"/content"+(a.inline?".inline":"")+".min.css"}return!1}function d(a){return"string"==typeof a?function(b){return-1!==b.indexOf(a)}:a instanceof RegExp?function(b){return a.test(b)}:a}function e(d,e){function f(a,d){var i,j=a.href;if(j=b(j),j&&e(j,d)&&!c(j)){h(a.imports,function(a){f(a,!0)});try{i=a.cssRules||a.rules}catch(k){}h(i,function(a){a.styleSheet?f(a.styleSheet,!0):a.selectorText&&h(a.selectorText.split(","),function(a){g.push(tinymce.trim(a))})})}}var g=[],i={};h(a.contentCSS,function(a){i[a]=!0}),e||(e=function(a,b){return b||i[a]});try{h(d.styleSheets,function(a){f(a)})}catch(j){}return g}function f(b){var c,d=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(b);if(d){var e=d[1],f=d[2].substr(1).split(".").join(" "),g=tinymce.makeMap("a,img");return d[1]?(c={title:b},a.schema.getTextBlockElements()[e]?c.block=e:a.schema.getBlockElements()[e]||g[e.toLowerCase()]?c.selector=e:c.inline=e):d[2]&&(c={inline:"span",title:b.substr(1),classes:f}),a.settings.importcss_merge_classes!==!1?c.classes=f:c.attributes={"class":f},c}}var g=this,h=tinymce.each;a.on("renderFormatsMenu",function(b){var c=a.settings,i={},j=c.importcss_selector_converter||f,k=d(c.importcss_selector_filter),l=b.control;a.settings.importcss_append||l.items().remove();var m=[];tinymce.each(c.importcss_groups,function(a){a=tinymce.extend({},a),a.filter=d(a.filter),m.push(a)}),h(e(b.doc||a.getDoc(),d(c.importcss_file_filter)),function(b){if(-1===b.indexOf(".mce-")&&!i[b]&&(!k||k(b))){var c,d=j.call(g,b);if(d){var e=d.name||tinymce.DOM.uniqueId();if(m)for(var f=0;f<m.length;f++)if(!m[f].filter||m[f].filter(b)){m[f].item||(m[f].item={text:m[f].title,menu:[]}),c=m[f].item.menu;break}a.formatter.register(e,d);var h=tinymce.extend({},l.settings.itemDefaults,{text:d.title,format:e});c?c.push(h):l.add(h)}i[b]=!0}}),h(m,function(a){l.add(a.item)}),b.control.renderNew()}),g.convertSelectorToFormat=f});
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('insertdatetime', function(editor) {
|
||||
var daysShort = "Sun Mon Tue Wed Thu Fri Sat Sun".split(' ');
|
||||
var daysLong = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(' ');
|
||||
var monthsShort = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(' ');
|
||||
var monthsLong = "January February March April May June July August September October November December".split(' ');
|
||||
var menuItems = [], lastFormat, defaultButtonTimeFormat;
|
||||
|
||||
function getDateTime(fmt, date) {
|
||||
function addZeros(value, len) {
|
||||
value = "" + value;
|
||||
|
||||
if (value.length < len) {
|
||||
for (var i = 0; i < (len - value.length); i++) {
|
||||
value = "0" + value;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
date = date || new Date();
|
||||
|
||||
fmt = fmt.replace("%D", "%m/%d/%Y");
|
||||
fmt = fmt.replace("%r", "%I:%M:%S %p");
|
||||
fmt = fmt.replace("%Y", "" + date.getFullYear());
|
||||
fmt = fmt.replace("%y", "" + date.getYear());
|
||||
fmt = fmt.replace("%m", addZeros(date.getMonth() + 1, 2));
|
||||
fmt = fmt.replace("%d", addZeros(date.getDate(), 2));
|
||||
fmt = fmt.replace("%H", "" + addZeros(date.getHours(), 2));
|
||||
fmt = fmt.replace("%M", "" + addZeros(date.getMinutes(), 2));
|
||||
fmt = fmt.replace("%S", "" + addZeros(date.getSeconds(), 2));
|
||||
fmt = fmt.replace("%I", "" + ((date.getHours() + 11) % 12 + 1));
|
||||
fmt = fmt.replace("%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
|
||||
fmt = fmt.replace("%B", "" + editor.translate(monthsLong[date.getMonth()]));
|
||||
fmt = fmt.replace("%b", "" + editor.translate(monthsShort[date.getMonth()]));
|
||||
fmt = fmt.replace("%A", "" + editor.translate(daysLong[date.getDay()]));
|
||||
fmt = fmt.replace("%a", "" + editor.translate(daysShort[date.getDay()]));
|
||||
fmt = fmt.replace("%%", "%");
|
||||
|
||||
return fmt;
|
||||
}
|
||||
|
||||
function insertDateTime(format) {
|
||||
var html = getDateTime(format);
|
||||
|
||||
if (editor.settings.insertdatetime_element) {
|
||||
var computerTime;
|
||||
|
||||
if (/%[HMSIp]/.test(format)) {
|
||||
computerTime = getDateTime("%Y-%m-%dT%H:%M");
|
||||
} else {
|
||||
computerTime = getDateTime("%Y-%m-%d");
|
||||
}
|
||||
|
||||
html = '<time datetime="' + computerTime + '">' + html + '</time>';
|
||||
|
||||
var timeElm = editor.dom.getParent(editor.selection.getStart(), 'time');
|
||||
if (timeElm) {
|
||||
editor.dom.setOuterHTML(timeElm, html);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
editor.insertContent(html);
|
||||
}
|
||||
|
||||
editor.addCommand('mceInsertDate', function() {
|
||||
insertDateTime(editor.getParam("insertdatetime_dateformat", editor.translate("%Y-%m-%d")));
|
||||
});
|
||||
|
||||
editor.addCommand('mceInsertTime', function() {
|
||||
insertDateTime(editor.getParam("insertdatetime_timeformat", editor.translate('%H:%M:%S')));
|
||||
});
|
||||
|
||||
editor.addButton('insertdatetime', {
|
||||
type: 'splitbutton',
|
||||
title: 'Insert date/time',
|
||||
onclick: function() {
|
||||
insertDateTime(lastFormat || defaultButtonTimeFormat);
|
||||
},
|
||||
menu: menuItems
|
||||
});
|
||||
|
||||
tinymce.each(editor.settings.insertdatetime_formats || [
|
||||
"%H:%M:%S",
|
||||
"%Y-%m-%d",
|
||||
"%I:%M:%S %p",
|
||||
"%D"
|
||||
], function(fmt) {
|
||||
if (!defaultButtonTimeFormat) {
|
||||
defaultButtonTimeFormat = fmt;
|
||||
}
|
||||
|
||||
menuItems.push({
|
||||
text: getDateTime(fmt),
|
||||
onclick: function() {
|
||||
lastFormat = fmt;
|
||||
insertDateTime(fmt);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editor.addMenuItem('insertdatetime', {
|
||||
icon: 'date',
|
||||
text: 'Insert date/time',
|
||||
menu: menuItems,
|
||||
context: 'insert'
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/insertdatetime/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("insertdatetime",function(a){function b(b,c){function d(a,b){if(a=""+a,a.length<b)for(var c=0;c<b-a.length;c++)a="0"+a;return a}return c=c||new Date,b=b.replace("%D","%m/%d/%Y"),b=b.replace("%r","%I:%M:%S %p"),b=b.replace("%Y",""+c.getFullYear()),b=b.replace("%y",""+c.getYear()),b=b.replace("%m",d(c.getMonth()+1,2)),b=b.replace("%d",d(c.getDate(),2)),b=b.replace("%H",""+d(c.getHours(),2)),b=b.replace("%M",""+d(c.getMinutes(),2)),b=b.replace("%S",""+d(c.getSeconds(),2)),b=b.replace("%I",""+((c.getHours()+11)%12+1)),b=b.replace("%p",""+(c.getHours()<12?"AM":"PM")),b=b.replace("%B",""+a.translate(i[c.getMonth()])),b=b.replace("%b",""+a.translate(h[c.getMonth()])),b=b.replace("%A",""+a.translate(g[c.getDay()])),b=b.replace("%a",""+a.translate(f[c.getDay()])),b=b.replace("%%","%")}function c(c){var d=b(c);if(a.settings.insertdatetime_element){var e;e=b(/%[HMSIp]/.test(c)?"%Y-%m-%dT%H:%M":"%Y-%m-%d"),d='<time datetime="'+e+'">'+d+"</time>";var f=a.dom.getParent(a.selection.getStart(),"time");if(f)return void a.dom.setOuterHTML(f,d)}a.insertContent(d)}var d,e,f="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),g="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),h="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),i="January February March April May June July August September October November December".split(" "),j=[];a.addCommand("mceInsertDate",function(){c(a.getParam("insertdatetime_dateformat",a.translate("%Y-%m-%d")))}),a.addCommand("mceInsertTime",function(){c(a.getParam("insertdatetime_timeformat",a.translate("%H:%M:%S")))}),a.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){c(d||e)},menu:j}),tinymce.each(a.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(a){e||(e=a),j.push({text:b(a),onclick:function(){d=a,c(a)}})}),a.addMenuItem("insertdatetime",{icon:"date",text:"Insert date/time",menu:j,context:"insert"})});
|
||||
225
assets/dashboard/plugins/tinymce/plugins/layer/plugin.js
Normal file
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('layer', function(editor) {
|
||||
function getParentLayer(node) {
|
||||
do {
|
||||
if (node.className && node.className.indexOf('mceItemLayer') != -1) {
|
||||
return node;
|
||||
}
|
||||
} while ((node = node.parentNode));
|
||||
}
|
||||
|
||||
function visualAid(e) {
|
||||
var dom = editor.dom;
|
||||
|
||||
tinymce.each(dom.select('div,p', e), function(e) {
|
||||
if (/^(absolute|relative|fixed)$/i.test(e.style.position)) {
|
||||
if (e.hasVisual) {
|
||||
dom.addClass(e, 'mceItemVisualAid');
|
||||
} else {
|
||||
dom.removeClass(e, 'mceItemVisualAid');
|
||||
}
|
||||
|
||||
dom.addClass(e, 'mceItemLayer');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function move(d) {
|
||||
var i, z = [], le = getParentLayer(editor.selection.getNode()), ci = -1, fi = -1, nl;
|
||||
|
||||
nl = [];
|
||||
tinymce.walk(editor.getBody(), function(n) {
|
||||
if (n.nodeType == 1 && /^(absolute|relative|static)$/i.test(n.style.position)) {
|
||||
nl.push(n);
|
||||
}
|
||||
}, 'childNodes');
|
||||
|
||||
// Find z-indexes
|
||||
for (i = 0; i < nl.length; i++) {
|
||||
z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex, 10) : 0;
|
||||
|
||||
if (ci < 0 && nl[i] == le) {
|
||||
ci = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (d < 0) {
|
||||
// Move back
|
||||
|
||||
// Try find a lower one
|
||||
for (i = 0; i < z.length; i++) {
|
||||
if (z[i] < z[ci]) {
|
||||
fi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fi > -1) {
|
||||
nl[ci].style.zIndex = z[fi];
|
||||
nl[fi].style.zIndex = z[ci];
|
||||
} else {
|
||||
if (z[ci] > 0) {
|
||||
nl[ci].style.zIndex = z[ci] - 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Move forward
|
||||
|
||||
// Try find a higher one
|
||||
for (i = 0; i < z.length; i++) {
|
||||
if (z[i] > z[ci]) {
|
||||
fi = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fi > -1) {
|
||||
nl[ci].style.zIndex = z[fi];
|
||||
nl[fi].style.zIndex = z[ci];
|
||||
} else {
|
||||
nl[ci].style.zIndex = z[ci] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
editor.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
function insertLayer() {
|
||||
var dom = editor.dom, p = dom.getPos(dom.getParent(editor.selection.getNode(), '*'));
|
||||
var body = editor.getBody();
|
||||
|
||||
editor.dom.add(body, 'div', {
|
||||
style: {
|
||||
position: 'absolute',
|
||||
left: p.x,
|
||||
top: (p.y > 20 ? p.y : 20),
|
||||
width: 100,
|
||||
height: 100
|
||||
},
|
||||
'class': 'mceItemVisualAid mceItemLayer'
|
||||
}, editor.selection.getContent() || editor.getLang('layer.content'));
|
||||
|
||||
// Workaround for IE where it messes up the JS engine if you insert a layer on IE 6,7
|
||||
if (tinymce.Env.ie) {
|
||||
dom.setHTML(body, body.innerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleAbsolute() {
|
||||
var le = getParentLayer(editor.selection.getNode());
|
||||
|
||||
if (!le) {
|
||||
le = editor.dom.getParent(editor.selection.getNode(), 'DIV,P,IMG');
|
||||
}
|
||||
|
||||
if (le) {
|
||||
if (le.style.position.toLowerCase() == "absolute") {
|
||||
editor.dom.setStyles(le, {
|
||||
position: '',
|
||||
left: '',
|
||||
top: '',
|
||||
width: '',
|
||||
height: ''
|
||||
});
|
||||
|
||||
editor.dom.removeClass(le, 'mceItemVisualAid');
|
||||
editor.dom.removeClass(le, 'mceItemLayer');
|
||||
} else {
|
||||
if (!le.style.left) {
|
||||
le.style.left = 20 + 'px';
|
||||
}
|
||||
|
||||
if (!le.style.top) {
|
||||
le.style.top = 20 + 'px';
|
||||
}
|
||||
|
||||
if (!le.style.width) {
|
||||
le.style.width = le.width ? (le.width + 'px') : '100px';
|
||||
}
|
||||
|
||||
if (!le.style.height) {
|
||||
le.style.height = le.height ? (le.height + 'px') : '100px';
|
||||
}
|
||||
|
||||
le.style.position = "absolute";
|
||||
|
||||
editor.dom.setAttrib(le, 'data-mce-style', '');
|
||||
editor.addVisual(editor.getBody());
|
||||
}
|
||||
|
||||
editor.execCommand('mceRepaint');
|
||||
editor.nodeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// Register commands
|
||||
editor.addCommand('mceInsertLayer', insertLayer);
|
||||
|
||||
editor.addCommand('mceMoveForward', function() {
|
||||
move(1);
|
||||
});
|
||||
|
||||
editor.addCommand('mceMoveBackward', function() {
|
||||
move(-1);
|
||||
});
|
||||
|
||||
editor.addCommand('mceMakeAbsolute', function() {
|
||||
toggleAbsolute();
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
editor.addButton('moveforward', {title: 'layer.forward_desc', cmd: 'mceMoveForward'});
|
||||
editor.addButton('movebackward', {title: 'layer.backward_desc', cmd: 'mceMoveBackward'});
|
||||
editor.addButton('absolute', {title: 'layer.absolute_desc', cmd: 'mceMakeAbsolute'});
|
||||
editor.addButton('insertlayer', {title: 'layer.insertlayer_desc', cmd: 'mceInsertLayer'});
|
||||
|
||||
editor.on('init', function() {
|
||||
if (tinymce.Env.ie) {
|
||||
editor.getDoc().execCommand('2D-Position', false, true);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove serialized styles when selecting a layer since it might be changed by a drag operation
|
||||
editor.on('mouseup', function(e) {
|
||||
var layer = getParentLayer(e.target);
|
||||
|
||||
if (layer) {
|
||||
editor.dom.setAttrib(layer, 'data-mce-style', '');
|
||||
}
|
||||
});
|
||||
|
||||
// Fixes edit focus issues with layers on Gecko
|
||||
// This will enable designMode while inside a layer and disable it when outside
|
||||
editor.on('mousedown', function(e) {
|
||||
var node = e.target, doc = editor.getDoc(), parent;
|
||||
|
||||
if (tinymce.Env.gecko) {
|
||||
if (getParentLayer(node)) {
|
||||
if (doc.designMode !== 'on') {
|
||||
doc.designMode = 'on';
|
||||
|
||||
// Repaint caret
|
||||
node = doc.body;
|
||||
parent = node.parentNode;
|
||||
parent.removeChild(node);
|
||||
parent.appendChild(node);
|
||||
}
|
||||
} else if (doc.designMode == 'on') {
|
||||
doc.designMode = 'off';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('NodeChange', visualAid);
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/layer/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("layer",function(a){function b(a){do if(a.className&&-1!=a.className.indexOf("mceItemLayer"))return a;while(a=a.parentNode)}function c(b){var c=a.dom;tinymce.each(c.select("div,p",b),function(a){/^(absolute|relative|fixed)$/i.test(a.style.position)&&(a.hasVisual?c.addClass(a,"mceItemVisualAid"):c.removeClass(a,"mceItemVisualAid"),c.addClass(a,"mceItemLayer"))})}function d(c){var d,e,f=[],g=b(a.selection.getNode()),h=-1,i=-1;for(e=[],tinymce.walk(a.getBody(),function(a){1==a.nodeType&&/^(absolute|relative|static)$/i.test(a.style.position)&&e.push(a)},"childNodes"),d=0;d<e.length;d++)f[d]=e[d].style.zIndex?parseInt(e[d].style.zIndex,10):0,0>h&&e[d]==g&&(h=d);if(0>c){for(d=0;d<f.length;d++)if(f[d]<f[h]){i=d;break}i>-1?(e[h].style.zIndex=f[i],e[i].style.zIndex=f[h]):f[h]>0&&(e[h].style.zIndex=f[h]-1)}else{for(d=0;d<f.length;d++)if(f[d]>f[h]){i=d;break}i>-1?(e[h].style.zIndex=f[i],e[i].style.zIndex=f[h]):e[h].style.zIndex=f[h]+1}a.execCommand("mceRepaint")}function e(){var b=a.dom,c=b.getPos(b.getParent(a.selection.getNode(),"*")),d=a.getBody();a.dom.add(d,"div",{style:{position:"absolute",left:c.x,top:c.y>20?c.y:20,width:100,height:100},"class":"mceItemVisualAid mceItemLayer"},a.selection.getContent()||a.getLang("layer.content")),tinymce.Env.ie&&b.setHTML(d,d.innerHTML)}function f(){var c=b(a.selection.getNode());c||(c=a.dom.getParent(a.selection.getNode(),"DIV,P,IMG")),c&&("absolute"==c.style.position.toLowerCase()?(a.dom.setStyles(c,{position:"",left:"",top:"",width:"",height:""}),a.dom.removeClass(c,"mceItemVisualAid"),a.dom.removeClass(c,"mceItemLayer")):(c.style.left||(c.style.left="20px"),c.style.top||(c.style.top="20px"),c.style.width||(c.style.width=c.width?c.width+"px":"100px"),c.style.height||(c.style.height=c.height?c.height+"px":"100px"),c.style.position="absolute",a.dom.setAttrib(c,"data-mce-style",""),a.addVisual(a.getBody())),a.execCommand("mceRepaint"),a.nodeChanged())}a.addCommand("mceInsertLayer",e),a.addCommand("mceMoveForward",function(){d(1)}),a.addCommand("mceMoveBackward",function(){d(-1)}),a.addCommand("mceMakeAbsolute",function(){f()}),a.addButton("moveforward",{title:"layer.forward_desc",cmd:"mceMoveForward"}),a.addButton("movebackward",{title:"layer.backward_desc",cmd:"mceMoveBackward"}),a.addButton("absolute",{title:"layer.absolute_desc",cmd:"mceMakeAbsolute"}),a.addButton("insertlayer",{title:"layer.insertlayer_desc",cmd:"mceInsertLayer"}),a.on("init",function(){tinymce.Env.ie&&a.getDoc().execCommand("2D-Position",!1,!0)}),a.on("mouseup",function(c){var d=b(c.target);d&&a.dom.setAttrib(d,"data-mce-style","")}),a.on("mousedown",function(c){var d,e=c.target,f=a.getDoc();tinymce.Env.gecko&&(b(e)?"on"!==f.designMode&&(f.designMode="on",e=f.body,d=e.parentNode,d.removeChild(e),d.appendChild(e)):"on"==f.designMode&&(f.designMode="off"))}),a.on("NodeChange",c)});
|
||||
208
assets/dashboard/plugins/tinymce/plugins/legacyoutput/plugin.js
Normal file
@@ -0,0 +1,208 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*
|
||||
* This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align
|
||||
* attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash
|
||||
*
|
||||
* However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are
|
||||
* not apart of the newer specifications for HTML and XHTML.
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
(function(tinymce) {
|
||||
tinymce.PluginManager.add('legacyoutput', function(editor, url, $) {
|
||||
editor.settings.inline_styles = false;
|
||||
|
||||
editor.on('init', function() {
|
||||
var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
|
||||
fontSizes = tinymce.explode(editor.settings.font_size_style_values),
|
||||
schema = editor.schema;
|
||||
|
||||
// Override some internal formats to produce legacy elements and attributes
|
||||
editor.formatter.register({
|
||||
// Change alignment formats to use the deprecated align attribute
|
||||
alignleft: {selector: alignElements, attributes: {align: 'left'}},
|
||||
aligncenter: {selector: alignElements, attributes: {align: 'center'}},
|
||||
alignright: {selector: alignElements, attributes: {align: 'right'}},
|
||||
alignjustify: {selector: alignElements, attributes: {align: 'justify'}},
|
||||
|
||||
// Change the basic formatting elements to use deprecated element types
|
||||
bold: [
|
||||
{inline: 'b', remove: 'all'},
|
||||
{inline: 'strong', remove: 'all'},
|
||||
{inline: 'span', styles: {fontWeight: 'bold'}}
|
||||
],
|
||||
italic: [
|
||||
{inline: 'i', remove: 'all'},
|
||||
{inline: 'em', remove: 'all'},
|
||||
{inline: 'span', styles: {fontStyle: 'italic'}}
|
||||
],
|
||||
underline: [
|
||||
{inline: 'u', remove: 'all'},
|
||||
{inline: 'span', styles: {textDecoration: 'underline'}, exact: true}
|
||||
],
|
||||
strikethrough: [
|
||||
{inline: 'strike', remove: 'all'},
|
||||
{inline: 'span', styles: {textDecoration: 'line-through'}, exact: true}
|
||||
],
|
||||
|
||||
// Change font size and font family to use the deprecated font element
|
||||
fontname: {inline: 'font', attributes: {face: '%value'}},
|
||||
fontsize: {
|
||||
inline: 'font',
|
||||
attributes: {
|
||||
size: function(vars) {
|
||||
return tinymce.inArray(fontSizes, vars.value) + 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Setup font elements for colors as well
|
||||
forecolor: {inline: 'font', attributes: {color: '%value'}},
|
||||
hilitecolor: {inline: 'font', styles: {backgroundColor: '%value'}}
|
||||
});
|
||||
|
||||
// Check that deprecated elements are allowed if not add them
|
||||
tinymce.each('b,i,u,strike'.split(','), function(name) {
|
||||
schema.addValidElements(name + '[*]');
|
||||
});
|
||||
|
||||
// Add font element if it's missing
|
||||
if (!schema.getElementRule("font")) {
|
||||
schema.addValidElements("font[face|size|color|style]");
|
||||
}
|
||||
|
||||
// Add the missing and depreacted align attribute for the serialization engine
|
||||
tinymce.each(alignElements.split(','), function(name) {
|
||||
var rule = schema.getElementRule(name);
|
||||
|
||||
if (rule) {
|
||||
if (!rule.attributes.align) {
|
||||
rule.attributes.align = {};
|
||||
rule.attributesOrder.push('align');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editor.addButton('fontsizeselect', function() {
|
||||
var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7';
|
||||
var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats;
|
||||
|
||||
editor.$.each(fontsize_formats.split(' '), function(i, item) {
|
||||
var text = item, value = item;
|
||||
var values = item.split('=');
|
||||
|
||||
if (values.length > 1) {
|
||||
text = values[0];
|
||||
value = values[1];
|
||||
}
|
||||
|
||||
items.push({text: text, value: value});
|
||||
});
|
||||
|
||||
return {
|
||||
type: 'listbox',
|
||||
text: 'Font Sizes',
|
||||
tooltip: 'Font Sizes',
|
||||
values: items,
|
||||
fixedWidth: true,
|
||||
onPostRender: function() {
|
||||
var self = this;
|
||||
|
||||
editor.on('NodeChange', function() {
|
||||
var fontElm;
|
||||
|
||||
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
|
||||
if (fontElm) {
|
||||
self.value(fontElm.size);
|
||||
} else {
|
||||
self.value('');
|
||||
}
|
||||
});
|
||||
},
|
||||
onclick: function(e) {
|
||||
if (e.control.settings.value) {
|
||||
editor.execCommand('FontSize', false, e.control.settings.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
editor.addButton('fontselect', function() {
|
||||
function createFormats(formats) {
|
||||
formats = formats.replace(/;$/, '').split(';');
|
||||
|
||||
var i = formats.length;
|
||||
while (i--) {
|
||||
formats[i] = formats[i].split('=');
|
||||
}
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
var defaultFontsFormats =
|
||||
'Andale Mono=andale mono,monospace;' +
|
||||
'Arial=arial,helvetica,sans-serif;' +
|
||||
'Arial Black=arial black,sans-serif;' +
|
||||
'Book Antiqua=book antiqua,palatino,serif;' +
|
||||
'Comic Sans MS=comic sans ms,sans-serif;' +
|
||||
'Courier New=courier new,courier,monospace;' +
|
||||
'Georgia=georgia,palatino,serif;' +
|
||||
'Helvetica=helvetica,arial,sans-serif;' +
|
||||
'Impact=impact,sans-serif;' +
|
||||
'Symbol=symbol;' +
|
||||
'Tahoma=tahoma,arial,helvetica,sans-serif;' +
|
||||
'Terminal=terminal,monaco,monospace;' +
|
||||
'Times New Roman=times new roman,times,serif;' +
|
||||
'Trebuchet MS=trebuchet ms,geneva,sans-serif;' +
|
||||
'Verdana=verdana,geneva,sans-serif;' +
|
||||
'Webdings=webdings;' +
|
||||
'Wingdings=wingdings,zapf dingbats';
|
||||
|
||||
var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
|
||||
|
||||
$.each(fonts, function(i, font) {
|
||||
items.push({
|
||||
text: {raw: font[0]},
|
||||
value: font[1],
|
||||
textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : ''
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
type: 'listbox',
|
||||
text: 'Font Family',
|
||||
tooltip: 'Font Family',
|
||||
values: items,
|
||||
fixedWidth: true,
|
||||
onPostRender: function() {
|
||||
var self = this;
|
||||
|
||||
editor.on('NodeChange', function() {
|
||||
var fontElm;
|
||||
|
||||
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
|
||||
if (fontElm) {
|
||||
self.value(fontElm.face);
|
||||
} else {
|
||||
self.value('');
|
||||
}
|
||||
});
|
||||
},
|
||||
onselect: function(e) {
|
||||
if (e.control.settings.value) {
|
||||
editor.execCommand('FontName', false, e.control.settings.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
})(tinymce);
|
||||
1
assets/dashboard/plugins/tinymce/plugins/legacyoutput/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(a){a.PluginManager.add("legacyoutput",function(b,c,d){b.settings.inline_styles=!1,b.on("init",function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",d=a.explode(b.settings.font_size_style_values),e=b.schema;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignjustify:{selector:c,attributes:{align:"justify"}},bold:[{inline:"b",remove:"all"},{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}}],italic:[{inline:"i",remove:"all"},{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}}],underline:[{inline:"u",remove:"all"},{inline:"span",styles:{textDecoration:"underline"},exact:!0}],strikethrough:[{inline:"strike",remove:"all"},{inline:"span",styles:{textDecoration:"line-through"},exact:!0}],fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(b){return a.inArray(d,b.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),a.each("b,i,u,strike".split(","),function(a){e.addValidElements(a+"[*]")}),e.getElementRule("font")||e.addValidElements("font[face|size|color|style]"),a.each(c.split(","),function(a){var b=e.getElementRule(a);b&&(b.attributes.align||(b.attributes.align={},b.attributesOrder.push("align")))})}),b.addButton("fontsizeselect",function(){var a=[],c="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7",d=b.settings.fontsize_formats||c;return b.$.each(d.split(" "),function(b,c){var d=c,e=c,f=c.split("=");f.length>1&&(d=f[0],e=f[1]),a.push({text:d,value:e})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:a,fixedWidth:!0,onPostRender:function(){var a=this;b.on("NodeChange",function(){var c;c=b.dom.getParent(b.selection.getNode(),"font"),c?a.value(c.size):a.value("")})},onclick:function(a){a.control.settings.value&&b.execCommand("FontSize",!1,a.control.settings.value)}}}),b.addButton("fontselect",function(){function a(a){a=a.replace(/;$/,"").split(";");for(var b=a.length;b--;)a[b]=a[b].split("=");return a}var c="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats",e=[],f=a(b.settings.font_formats||c);return d.each(f,function(a,b){e.push({text:{raw:b[0]},value:b[1],textStyle:-1==b[1].indexOf("dings")?"font-family:"+b[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:e,fixedWidth:!0,onPostRender:function(){var a=this;b.on("NodeChange",function(){var c;c=b.dom.getParent(b.selection.getNode(),"font"),c?a.value(c.face):a.value("")})},onselect:function(a){a.control.settings.value&&b.execCommand("FontName",!1,a.control.settings.value)}}})})}(tinymce);
|
||||
403
assets/dashboard/plugins/tinymce/plugins/link/plugin.js
Normal file
@@ -0,0 +1,403 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('link', function(editor) {
|
||||
function createLinkList(callback) {
|
||||
return function() {
|
||||
var linkList = editor.settings.link_list;
|
||||
|
||||
if (typeof linkList == "string") {
|
||||
tinymce.util.XHR.send({
|
||||
url: linkList,
|
||||
success: function(text) {
|
||||
callback(tinymce.util.JSON.parse(text));
|
||||
}
|
||||
});
|
||||
} else if (typeof linkList == "function") {
|
||||
linkList(callback);
|
||||
} else {
|
||||
callback(linkList);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function buildListItems(inputList, itemCallback, startItems) {
|
||||
function appendItems(values, output) {
|
||||
output = output || [];
|
||||
|
||||
tinymce.each(values, function(item) {
|
||||
var menuItem = {text: item.text || item.title};
|
||||
|
||||
if (item.menu) {
|
||||
menuItem.menu = appendItems(item.menu);
|
||||
} else {
|
||||
menuItem.value = item.value;
|
||||
|
||||
if (itemCallback) {
|
||||
itemCallback(menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
output.push(menuItem);
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
return appendItems(inputList, startItems || []);
|
||||
}
|
||||
|
||||
function showDialog(linkList) {
|
||||
var data = {}, selection = editor.selection, dom = editor.dom, selectedElm, anchorElm, initialText;
|
||||
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
|
||||
|
||||
function linkListChangeHandler(e) {
|
||||
var textCtrl = win.find('#text');
|
||||
|
||||
if (!textCtrl.value() || (e.lastControl && textCtrl.value() == e.lastControl.text())) {
|
||||
textCtrl.value(e.control.text());
|
||||
}
|
||||
|
||||
win.find('#href').value(e.control.value());
|
||||
}
|
||||
|
||||
function buildAnchorListControl(url) {
|
||||
var anchorList = [];
|
||||
|
||||
tinymce.each(editor.dom.select('a:not([href])'), function(anchor) {
|
||||
var id = anchor.name || anchor.id;
|
||||
|
||||
if (id) {
|
||||
anchorList.push({
|
||||
text: id,
|
||||
value: '#' + id,
|
||||
selected: url.indexOf('#' + id) != -1
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (anchorList.length) {
|
||||
anchorList.unshift({text: 'None', value: ''});
|
||||
|
||||
return {
|
||||
name: 'anchor',
|
||||
type: 'listbox',
|
||||
label: 'Anchors',
|
||||
values: anchorList,
|
||||
onselect: linkListChangeHandler
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function updateText() {
|
||||
if (!initialText && data.text.length === 0 && onlyText) {
|
||||
this.parent().parent().find('#text')[0].value(this.value());
|
||||
}
|
||||
}
|
||||
|
||||
function urlChange(e) {
|
||||
var meta = e.meta || {};
|
||||
|
||||
if (linkListCtrl) {
|
||||
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
|
||||
}
|
||||
|
||||
tinymce.each(e.meta, function(value, key) {
|
||||
win.find('#' + key).value(value);
|
||||
});
|
||||
|
||||
if (!meta.text) {
|
||||
updateText.call(this);
|
||||
}
|
||||
}
|
||||
|
||||
function isOnlyTextSelected(anchorElm) {
|
||||
var html = selection.getContent();
|
||||
|
||||
// Partial html and not a fully selected anchor element
|
||||
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (anchorElm) {
|
||||
var nodes = anchorElm.childNodes, i;
|
||||
|
||||
if (nodes.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = nodes.length - 1; i >= 0; i--) {
|
||||
if (nodes[i].nodeType != 3) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
selectedElm = selection.getNode();
|
||||
anchorElm = dom.getParent(selectedElm, 'a[href]');
|
||||
onlyText = isOnlyTextSelected();
|
||||
|
||||
data.text = initialText = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'});
|
||||
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
|
||||
|
||||
if (anchorElm) {
|
||||
data.target = dom.getAttrib(anchorElm, 'target');
|
||||
} else if (editor.settings.default_link_target) {
|
||||
data.target = editor.settings.default_link_target;
|
||||
}
|
||||
|
||||
if ((value = dom.getAttrib(anchorElm, 'rel'))) {
|
||||
data.rel = value;
|
||||
}
|
||||
|
||||
if ((value = dom.getAttrib(anchorElm, 'class'))) {
|
||||
data['class'] = value;
|
||||
}
|
||||
|
||||
if ((value = dom.getAttrib(anchorElm, 'title'))) {
|
||||
data.title = value;
|
||||
}
|
||||
|
||||
if (onlyText) {
|
||||
textListCtrl = {
|
||||
name: 'text',
|
||||
type: 'textbox',
|
||||
size: 40,
|
||||
label: 'Text to display',
|
||||
onchange: function() {
|
||||
data.text = this.value();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (linkList) {
|
||||
linkListCtrl = {
|
||||
type: 'listbox',
|
||||
label: 'Link list',
|
||||
values: buildListItems(
|
||||
linkList,
|
||||
function(item) {
|
||||
item.value = editor.convertURL(item.value || item.url, 'href');
|
||||
},
|
||||
[{text: 'None', value: ''}]
|
||||
),
|
||||
onselect: linkListChangeHandler,
|
||||
value: editor.convertURL(data.href, 'href'),
|
||||
onPostRender: function() {
|
||||
/*eslint consistent-this:0*/
|
||||
linkListCtrl = this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (editor.settings.target_list !== false) {
|
||||
if (!editor.settings.target_list) {
|
||||
editor.settings.target_list = [
|
||||
{text: 'None', value: ''},
|
||||
{text: 'New window', value: '_blank'}
|
||||
];
|
||||
}
|
||||
|
||||
targetListCtrl = {
|
||||
name: 'target',
|
||||
type: 'listbox',
|
||||
label: 'Target',
|
||||
values: buildListItems(editor.settings.target_list)
|
||||
};
|
||||
}
|
||||
|
||||
if (editor.settings.rel_list) {
|
||||
relListCtrl = {
|
||||
name: 'rel',
|
||||
type: 'listbox',
|
||||
label: 'Rel',
|
||||
values: buildListItems(editor.settings.rel_list)
|
||||
};
|
||||
}
|
||||
|
||||
if (editor.settings.link_class_list) {
|
||||
classListCtrl = {
|
||||
name: 'class',
|
||||
type: 'listbox',
|
||||
label: 'Class',
|
||||
values: buildListItems(
|
||||
editor.settings.link_class_list,
|
||||
function(item) {
|
||||
if (item.value) {
|
||||
item.textStyle = function() {
|
||||
return editor.formatter.getCssText({inline: 'a', classes: [item.value]});
|
||||
};
|
||||
}
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
if (editor.settings.link_title !== false) {
|
||||
linkTitleCtrl = {
|
||||
name: 'title',
|
||||
type: 'textbox',
|
||||
label: 'Title',
|
||||
value: data.title
|
||||
};
|
||||
}
|
||||
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert link',
|
||||
data: data,
|
||||
body: [
|
||||
{
|
||||
name: 'href',
|
||||
type: 'filepicker',
|
||||
filetype: 'file',
|
||||
size: 40,
|
||||
autofocus: true,
|
||||
label: 'Url',
|
||||
onchange: urlChange,
|
||||
onkeyup: updateText
|
||||
},
|
||||
textListCtrl,
|
||||
linkTitleCtrl,
|
||||
buildAnchorListControl(data.href),
|
||||
linkListCtrl,
|
||||
relListCtrl,
|
||||
targetListCtrl,
|
||||
classListCtrl
|
||||
],
|
||||
onSubmit: function(e) {
|
||||
/*eslint dot-notation: 0*/
|
||||
var href;
|
||||
|
||||
data = tinymce.extend(data, e.data);
|
||||
href = data.href;
|
||||
|
||||
// Delay confirm since onSubmit will move focus
|
||||
function delayedConfirm(message, callback) {
|
||||
var rng = editor.selection.getRng();
|
||||
|
||||
tinymce.util.Delay.setEditorTimeout(editor, function() {
|
||||
editor.windowManager.confirm(message, function(state) {
|
||||
editor.selection.setRng(rng);
|
||||
callback(state);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function insertLink() {
|
||||
var linkAttrs = {
|
||||
href: href,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null,
|
||||
"class": data["class"] ? data["class"] : null,
|
||||
title: data.title ? data.title : null
|
||||
};
|
||||
|
||||
if (anchorElm) {
|
||||
editor.focus();
|
||||
|
||||
if (onlyText && data.text != initialText) {
|
||||
if ("innerText" in anchorElm) {
|
||||
anchorElm.innerText = data.text;
|
||||
} else {
|
||||
anchorElm.textContent = data.text;
|
||||
}
|
||||
}
|
||||
|
||||
dom.setAttribs(anchorElm, linkAttrs);
|
||||
|
||||
selection.select(anchorElm);
|
||||
editor.undoManager.add();
|
||||
} else {
|
||||
if (onlyText) {
|
||||
editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(data.text)));
|
||||
} else {
|
||||
editor.execCommand('mceInsertLink', false, linkAttrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!href) {
|
||||
editor.execCommand('unlink');
|
||||
return;
|
||||
}
|
||||
|
||||
// Is email and not //user@domain.com
|
||||
if (href.indexOf('@') > 0 && href.indexOf('//') == -1 && href.indexOf('mailto:') == -1) {
|
||||
delayedConfirm(
|
||||
'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
|
||||
function(state) {
|
||||
if (state) {
|
||||
href = 'mailto:' + href;
|
||||
}
|
||||
|
||||
insertLink();
|
||||
}
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Is not protocol prefixed
|
||||
if ((editor.settings.link_assume_external_targets && !/^\w+:/i.test(href)) ||
|
||||
(!editor.settings.link_assume_external_targets && /^\s*www[\.|\d\.]/i.test(href))) {
|
||||
delayedConfirm(
|
||||
'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
|
||||
function(state) {
|
||||
if (state) {
|
||||
href = 'http://' + href;
|
||||
}
|
||||
|
||||
insertLink();
|
||||
}
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
insertLink();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
editor.addButton('link', {
|
||||
icon: 'link',
|
||||
tooltip: 'Insert/edit link',
|
||||
shortcut: 'Meta+K',
|
||||
onclick: createLinkList(showDialog),
|
||||
stateSelector: 'a[href]'
|
||||
});
|
||||
|
||||
editor.addButton('unlink', {
|
||||
icon: 'unlink',
|
||||
tooltip: 'Remove link',
|
||||
cmd: 'unlink',
|
||||
stateSelector: 'a[href]'
|
||||
});
|
||||
|
||||
editor.addShortcut('Meta+K', '', createLinkList(showDialog));
|
||||
editor.addCommand('mceLink', createLinkList(showDialog));
|
||||
|
||||
this.showDialog = showDialog;
|
||||
|
||||
editor.addMenuItem('link', {
|
||||
icon: 'link',
|
||||
text: 'Insert/edit link',
|
||||
shortcut: 'Meta+K',
|
||||
onclick: createLinkList(showDialog),
|
||||
stateSelector: 'a[href]',
|
||||
context: 'insert',
|
||||
prependToContext: true
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/link/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("link",function(a){function b(b){return function(){var c=a.settings.link_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b&&b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){function d(a){var b=l.find("#text");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),l.find("#href").value(a.control.value())}function e(b){var c=[];return tinymce.each(a.dom.select("a:not([href])"),function(a){var d=a.name||a.id;d&&c.push({text:d,value:"#"+d,selected:-1!=b.indexOf("#"+d)})}),c.length?(c.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:c,onselect:d}):void 0}function f(){!k&&0===u.text.length&&m&&this.parent().parent().find("#text")[0].value(this.value())}function g(b){var c=b.meta||{};o&&o.value(a.convertURL(this.value(),"href")),tinymce.each(b.meta,function(a,b){l.find("#"+b).value(a)}),c.text||f.call(this)}function h(a){var b=v.getContent();if(/</.test(b)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(b)||-1==b.indexOf("href=")))return!1;if(a){var c,d=a.childNodes;if(0===d.length)return!1;for(c=d.length-1;c>=0;c--)if(3!=d[c].nodeType)return!1}return!0}var i,j,k,l,m,n,o,p,q,r,s,t,u={},v=a.selection,w=a.dom;i=v.getNode(),j=w.getParent(i,"a[href]"),m=h(),u.text=k=j?j.innerText||j.textContent:v.getContent({format:"text"}),u.href=j?w.getAttrib(j,"href"):"",j?u.target=w.getAttrib(j,"target"):a.settings.default_link_target&&(u.target=a.settings.default_link_target),(t=w.getAttrib(j,"rel"))&&(u.rel=t),(t=w.getAttrib(j,"class"))&&(u["class"]=t),(t=w.getAttrib(j,"title"))&&(u.title=t),m&&(n={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){u.text=this.value()}}),b&&(o={type:"listbox",label:"Link list",values:c(b,function(b){b.value=a.convertURL(b.value||b.url,"href")},[{text:"None",value:""}]),onselect:d,value:a.convertURL(u.href,"href"),onPostRender:function(){o=this}}),a.settings.target_list!==!1&&(a.settings.target_list||(a.settings.target_list=[{text:"None",value:""},{text:"New window",value:"_blank"}]),q={name:"target",type:"listbox",label:"Target",values:c(a.settings.target_list)}),a.settings.rel_list&&(p={name:"rel",type:"listbox",label:"Rel",values:c(a.settings.rel_list)}),a.settings.link_class_list&&(r={name:"class",type:"listbox",label:"Class",values:c(a.settings.link_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"a",classes:[b.value]})})})}),a.settings.link_title!==!1&&(s={name:"title",type:"textbox",label:"Title",value:u.title}),l=a.windowManager.open({title:"Insert link",data:u,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:g,onkeyup:f},n,s,e(u.href),o,p,q,r],onSubmit:function(b){function c(b,c){var d=a.selection.getRng();tinymce.util.Delay.setEditorTimeout(a,function(){a.windowManager.confirm(b,function(b){a.selection.setRng(d),c(b)})})}function d(){var b={href:e,target:u.target?u.target:null,rel:u.rel?u.rel:null,"class":u["class"]?u["class"]:null,title:u.title?u.title:null};j?(a.focus(),m&&u.text!=k&&("innerText"in j?j.innerText=u.text:j.textContent=u.text),w.setAttribs(j,b),v.select(j),a.undoManager.add()):m?a.insertContent(w.createHTML("a",b,w.encode(u.text))):a.execCommand("mceInsertLink",!1,b)}var e;return u=tinymce.extend(u,b.data),(e=u.href)?e.indexOf("@")>0&&-1==e.indexOf("//")&&-1==e.indexOf("mailto:")?void c("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(a){a&&(e="mailto:"+e),d()}):a.settings.link_assume_external_targets&&!/^\w+:/i.test(e)||!a.settings.link_assume_external_targets&&/^\s*www[\.|\d\.]/i.test(e)?void c("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(a){a&&(e="http://"+e),d()}):void d():void a.execCommand("unlink")}})}a.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onclick:b(d),stateSelector:"a[href]"}),a.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),a.addShortcut("Meta+K","",b(d)),a.addCommand("mceLink",b(d)),this.showDialog=d,a.addMenuItem("link",{icon:"link",text:"Insert/edit link",shortcut:"Meta+K",onclick:b(d),stateSelector:"a[href]",context:"insert",prependToContext:!0})});
|
||||
915
assets/dashboard/plugins/tinymce/plugins/lists/plugin.js
Normal file
@@ -0,0 +1,915 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
/*eslint consistent-this:0 */
|
||||
|
||||
tinymce.PluginManager.add('lists', function(editor) {
|
||||
var self = this;
|
||||
|
||||
function isChildOfBody(elm) {
|
||||
return editor.$.contains(editor.getBody(), elm);
|
||||
}
|
||||
|
||||
function isBr(node) {
|
||||
return node && node.nodeName == 'BR';
|
||||
}
|
||||
|
||||
function isListNode(node) {
|
||||
return node && (/^(OL|UL|DL)$/).test(node.nodeName) && isChildOfBody(node);
|
||||
}
|
||||
|
||||
function isFirstChild(node) {
|
||||
return node.parentNode.firstChild == node;
|
||||
}
|
||||
|
||||
function isLastChild(node) {
|
||||
return node.parentNode.lastChild == node;
|
||||
}
|
||||
|
||||
function isTextBlock(node) {
|
||||
return node && !!editor.schema.getTextBlockElements()[node.nodeName];
|
||||
}
|
||||
|
||||
function isEditorBody(elm) {
|
||||
return elm === editor.getBody();
|
||||
}
|
||||
|
||||
editor.on('init', function() {
|
||||
var dom = editor.dom, selection = editor.selection;
|
||||
|
||||
function isEmpty(elm, keepBookmarks) {
|
||||
var empty = dom.isEmpty(elm);
|
||||
|
||||
if (keepBookmarks && dom.select('span[data-mce-type=bookmark]').length > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return empty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with
|
||||
* index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans
|
||||
* added to them since they can be restored after a dom operation.
|
||||
*
|
||||
* So this: <p><b>|</b><b>|</b></p>
|
||||
* becomes: <p><b><span data-mce-type="bookmark">|</span></b><b data-mce-type="bookmark">|</span></b></p>
|
||||
*
|
||||
* @param {DOMRange} rng DOM Range to get bookmark on.
|
||||
* @return {Object} Bookmark object.
|
||||
*/
|
||||
function createBookmark(rng) {
|
||||
var bookmark = {};
|
||||
|
||||
function setupEndPoint(start) {
|
||||
var offsetNode, container, offset;
|
||||
|
||||
container = rng[start ? 'startContainer' : 'endContainer'];
|
||||
offset = rng[start ? 'startOffset' : 'endOffset'];
|
||||
|
||||
if (container.nodeType == 1) {
|
||||
offsetNode = dom.create('span', {'data-mce-type': 'bookmark'});
|
||||
|
||||
if (container.hasChildNodes()) {
|
||||
offset = Math.min(offset, container.childNodes.length - 1);
|
||||
|
||||
if (start) {
|
||||
container.insertBefore(offsetNode, container.childNodes[offset]);
|
||||
} else {
|
||||
dom.insertAfter(offsetNode, container.childNodes[offset]);
|
||||
}
|
||||
} else {
|
||||
container.appendChild(offsetNode);
|
||||
}
|
||||
|
||||
container = offsetNode;
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
bookmark[start ? 'startContainer' : 'endContainer'] = container;
|
||||
bookmark[start ? 'startOffset' : 'endOffset'] = offset;
|
||||
}
|
||||
|
||||
setupEndPoint(true);
|
||||
|
||||
if (!rng.collapsed) {
|
||||
setupEndPoint();
|
||||
}
|
||||
|
||||
return bookmark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the selection to the current bookmark and removes any selection container wrappers.
|
||||
*
|
||||
* @param {Object} bookmark Bookmark object to move selection to.
|
||||
*/
|
||||
function moveToBookmark(bookmark) {
|
||||
function restoreEndPoint(start) {
|
||||
var container, offset, node;
|
||||
|
||||
function nodeIndex(container) {
|
||||
var node = container.parentNode.firstChild, idx = 0;
|
||||
|
||||
while (node) {
|
||||
if (node == container) {
|
||||
return idx;
|
||||
}
|
||||
|
||||
// Skip data-mce-type=bookmark nodes
|
||||
if (node.nodeType != 1 || node.getAttribute('data-mce-type') != 'bookmark') {
|
||||
idx++;
|
||||
}
|
||||
|
||||
node = node.nextSibling;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
container = node = bookmark[start ? 'startContainer' : 'endContainer'];
|
||||
offset = bookmark[start ? 'startOffset' : 'endOffset'];
|
||||
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (container.nodeType == 1) {
|
||||
offset = nodeIndex(container);
|
||||
container = container.parentNode;
|
||||
dom.remove(node);
|
||||
}
|
||||
|
||||
bookmark[start ? 'startContainer' : 'endContainer'] = container;
|
||||
bookmark[start ? 'startOffset' : 'endOffset'] = offset;
|
||||
}
|
||||
|
||||
restoreEndPoint(true);
|
||||
restoreEndPoint();
|
||||
|
||||
var rng = dom.createRng();
|
||||
|
||||
rng.setStart(bookmark.startContainer, bookmark.startOffset);
|
||||
|
||||
if (bookmark.endContainer) {
|
||||
rng.setEnd(bookmark.endContainer, bookmark.endOffset);
|
||||
}
|
||||
|
||||
selection.setRng(rng);
|
||||
}
|
||||
|
||||
function createNewTextBlock(contentNode, blockName) {
|
||||
var node, textBlock, fragment = dom.createFragment(), hasContentNode;
|
||||
var blockElements = editor.schema.getBlockElements();
|
||||
|
||||
if (editor.settings.forced_root_block) {
|
||||
blockName = blockName || editor.settings.forced_root_block;
|
||||
}
|
||||
|
||||
if (blockName) {
|
||||
textBlock = dom.create(blockName);
|
||||
|
||||
if (textBlock.tagName === editor.settings.forced_root_block) {
|
||||
dom.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
|
||||
}
|
||||
|
||||
fragment.appendChild(textBlock);
|
||||
}
|
||||
|
||||
if (contentNode) {
|
||||
while ((node = contentNode.firstChild)) {
|
||||
var nodeName = node.nodeName;
|
||||
|
||||
if (!hasContentNode && (nodeName != 'SPAN' || node.getAttribute('data-mce-type') != 'bookmark')) {
|
||||
hasContentNode = true;
|
||||
}
|
||||
|
||||
if (blockElements[nodeName]) {
|
||||
fragment.appendChild(node);
|
||||
textBlock = null;
|
||||
} else {
|
||||
if (blockName) {
|
||||
if (!textBlock) {
|
||||
textBlock = dom.create(blockName);
|
||||
fragment.appendChild(textBlock);
|
||||
}
|
||||
|
||||
textBlock.appendChild(node);
|
||||
} else {
|
||||
fragment.appendChild(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!editor.settings.forced_root_block) {
|
||||
fragment.appendChild(dom.create('br'));
|
||||
} else {
|
||||
// BR is needed in empty blocks on non IE browsers
|
||||
if (!hasContentNode && (!tinymce.Env.ie || tinymce.Env.ie > 10)) {
|
||||
textBlock.appendChild(dom.create('br', {'data-mce-bogus': '1'}));
|
||||
}
|
||||
}
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
function getSelectedListItems() {
|
||||
return tinymce.grep(selection.getSelectedBlocks(), function(block) {
|
||||
return /^(LI|DT|DD)$/.test(block.nodeName);
|
||||
});
|
||||
}
|
||||
|
||||
function splitList(ul, li, newBlock) {
|
||||
var tmpRng, fragment, bookmarks, node;
|
||||
|
||||
function removeAndKeepBookmarks(targetNode) {
|
||||
tinymce.each(bookmarks, function(node) {
|
||||
targetNode.parentNode.insertBefore(node, li.parentNode);
|
||||
});
|
||||
|
||||
dom.remove(targetNode);
|
||||
}
|
||||
|
||||
bookmarks = dom.select('span[data-mce-type="bookmark"]', ul);
|
||||
newBlock = newBlock || createNewTextBlock(li);
|
||||
tmpRng = dom.createRng();
|
||||
tmpRng.setStartAfter(li);
|
||||
tmpRng.setEndAfter(ul);
|
||||
fragment = tmpRng.extractContents();
|
||||
|
||||
for (node = fragment.firstChild; node; node = node.firstChild) {
|
||||
if (node.nodeName == 'LI' && dom.isEmpty(node)) {
|
||||
dom.remove(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dom.isEmpty(fragment)) {
|
||||
dom.insertAfter(fragment, ul);
|
||||
}
|
||||
|
||||
dom.insertAfter(newBlock, ul);
|
||||
|
||||
if (isEmpty(li.parentNode)) {
|
||||
removeAndKeepBookmarks(li.parentNode);
|
||||
}
|
||||
|
||||
dom.remove(li);
|
||||
|
||||
if (isEmpty(ul)) {
|
||||
dom.remove(ul);
|
||||
}
|
||||
}
|
||||
|
||||
var shouldMerge = function (listBlock, sibling) {
|
||||
var targetStyle = editor.dom.getStyle(listBlock, 'list-style-type', true);
|
||||
var style = editor.dom.getStyle(sibling, 'list-style-type', true);
|
||||
return targetStyle === style;
|
||||
};
|
||||
|
||||
function mergeWithAdjacentLists(listBlock) {
|
||||
var sibling, node;
|
||||
|
||||
sibling = listBlock.nextSibling;
|
||||
if (sibling && isListNode(sibling) && sibling.nodeName == listBlock.nodeName && shouldMerge(listBlock, sibling)) {
|
||||
while ((node = sibling.firstChild)) {
|
||||
listBlock.appendChild(node);
|
||||
}
|
||||
|
||||
dom.remove(sibling);
|
||||
}
|
||||
|
||||
sibling = listBlock.previousSibling;
|
||||
if (sibling && isListNode(sibling) && sibling.nodeName == listBlock.nodeName && shouldMerge(listBlock, sibling)) {
|
||||
while ((node = sibling.firstChild)) {
|
||||
listBlock.insertBefore(node, listBlock.firstChild);
|
||||
}
|
||||
|
||||
dom.remove(sibling);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the all lists in the specified element.
|
||||
*/
|
||||
function normalizeList(element) {
|
||||
tinymce.each(tinymce.grep(dom.select('ol,ul', element)), function(ul) {
|
||||
var sibling, parentNode = ul.parentNode;
|
||||
|
||||
// Move UL/OL to previous LI if it's the only child of a LI
|
||||
if (parentNode.nodeName == 'LI' && parentNode.firstChild == ul) {
|
||||
sibling = parentNode.previousSibling;
|
||||
if (sibling && sibling.nodeName == 'LI') {
|
||||
sibling.appendChild(ul);
|
||||
|
||||
if (isEmpty(parentNode)) {
|
||||
dom.remove(parentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Append OL/UL to previous LI if it's in a parent OL/UL i.e. old HTML4
|
||||
if (isListNode(parentNode)) {
|
||||
sibling = parentNode.previousSibling;
|
||||
if (sibling && sibling.nodeName == 'LI') {
|
||||
sibling.appendChild(ul);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function outdent(li) {
|
||||
var ul = li.parentNode, ulParent = ul.parentNode, newBlock;
|
||||
|
||||
function removeEmptyLi(li) {
|
||||
if (isEmpty(li)) {
|
||||
dom.remove(li);
|
||||
}
|
||||
}
|
||||
|
||||
if (isEditorBody(ul)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (li.nodeName == 'DD') {
|
||||
dom.rename(li, 'DT');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isFirstChild(li) && isLastChild(li)) {
|
||||
if (ulParent.nodeName == "LI") {
|
||||
dom.insertAfter(li, ulParent);
|
||||
removeEmptyLi(ulParent);
|
||||
dom.remove(ul);
|
||||
} else if (isListNode(ulParent)) {
|
||||
dom.remove(ul, true);
|
||||
} else {
|
||||
ulParent.insertBefore(createNewTextBlock(li), ul);
|
||||
dom.remove(ul);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (isFirstChild(li)) {
|
||||
if (ulParent.nodeName == "LI") {
|
||||
dom.insertAfter(li, ulParent);
|
||||
li.appendChild(ul);
|
||||
removeEmptyLi(ulParent);
|
||||
} else if (isListNode(ulParent)) {
|
||||
ulParent.insertBefore(li, ul);
|
||||
} else {
|
||||
ulParent.insertBefore(createNewTextBlock(li), ul);
|
||||
dom.remove(li);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (isLastChild(li)) {
|
||||
if (ulParent.nodeName == "LI") {
|
||||
dom.insertAfter(li, ulParent);
|
||||
} else if (isListNode(ulParent)) {
|
||||
dom.insertAfter(li, ul);
|
||||
} else {
|
||||
dom.insertAfter(createNewTextBlock(li), ul);
|
||||
dom.remove(li);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ulParent.nodeName == 'LI') {
|
||||
ul = ulParent;
|
||||
newBlock = createNewTextBlock(li, 'LI');
|
||||
} else if (isListNode(ulParent)) {
|
||||
newBlock = createNewTextBlock(li, 'LI');
|
||||
} else {
|
||||
newBlock = createNewTextBlock(li);
|
||||
}
|
||||
|
||||
splitList(ul, li, newBlock);
|
||||
normalizeList(ul.parentNode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function indent(li) {
|
||||
var sibling, newList, listStyle;
|
||||
|
||||
function mergeLists(from, to) {
|
||||
var node;
|
||||
|
||||
if (isListNode(from)) {
|
||||
while ((node = li.lastChild.firstChild)) {
|
||||
to.appendChild(node);
|
||||
}
|
||||
|
||||
dom.remove(from);
|
||||
}
|
||||
}
|
||||
|
||||
if (li.nodeName == 'DT') {
|
||||
dom.rename(li, 'DD');
|
||||
return true;
|
||||
}
|
||||
|
||||
sibling = li.previousSibling;
|
||||
|
||||
if (sibling && isListNode(sibling)) {
|
||||
sibling.appendChild(li);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sibling && sibling.nodeName == 'LI' && isListNode(sibling.lastChild)) {
|
||||
sibling.lastChild.appendChild(li);
|
||||
mergeLists(li.lastChild, sibling.lastChild);
|
||||
return true;
|
||||
}
|
||||
|
||||
sibling = li.nextSibling;
|
||||
|
||||
if (sibling && isListNode(sibling)) {
|
||||
sibling.insertBefore(li, sibling.firstChild);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*if (sibling && sibling.nodeName == 'LI' && isListNode(li.lastChild)) {
|
||||
return false;
|
||||
}*/
|
||||
|
||||
sibling = li.previousSibling;
|
||||
if (sibling && sibling.nodeName == 'LI') {
|
||||
newList = dom.create(li.parentNode.nodeName);
|
||||
listStyle = dom.getStyle(li.parentNode, 'listStyleType');
|
||||
if (listStyle) {
|
||||
dom.setStyle(newList, 'listStyleType', listStyle);
|
||||
}
|
||||
sibling.appendChild(newList);
|
||||
newList.appendChild(li);
|
||||
mergeLists(li.lastChild, newList);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function indentSelection() {
|
||||
var listElements = getSelectedListItems();
|
||||
|
||||
if (listElements.length) {
|
||||
var bookmark = createBookmark(selection.getRng(true));
|
||||
|
||||
for (var i = 0; i < listElements.length; i++) {
|
||||
if (!indent(listElements[i]) && i === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function outdentSelection() {
|
||||
var listElements = getSelectedListItems();
|
||||
|
||||
if (listElements.length) {
|
||||
var bookmark = createBookmark(selection.getRng(true));
|
||||
var i, y, root = editor.getBody();
|
||||
|
||||
i = listElements.length;
|
||||
while (i--) {
|
||||
var node = listElements[i].parentNode;
|
||||
|
||||
while (node && node != root) {
|
||||
y = listElements.length;
|
||||
while (y--) {
|
||||
if (listElements[y] === node) {
|
||||
listElements.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < listElements.length; i++) {
|
||||
if (!outdent(listElements[i]) && i === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
moveToBookmark(bookmark);
|
||||
editor.nodeChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function applyList(listName, detail) {
|
||||
var rng = selection.getRng(true), bookmark, listItemName = 'LI';
|
||||
|
||||
if (dom.getContentEditable(selection.getNode()) === "false") {
|
||||
return;
|
||||
}
|
||||
|
||||
listName = listName.toUpperCase();
|
||||
|
||||
if (listName == 'DL') {
|
||||
listItemName = 'DT';
|
||||
}
|
||||
|
||||
function getSelectedTextBlocks() {
|
||||
var textBlocks = [], root = editor.getBody();
|
||||
|
||||
function getEndPointNode(start) {
|
||||
var container, offset;
|
||||
|
||||
container = rng[start ? 'startContainer' : 'endContainer'];
|
||||
offset = rng[start ? 'startOffset' : 'endOffset'];
|
||||
|
||||
// Resolve node index
|
||||
if (container.nodeType == 1) {
|
||||
container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
|
||||
}
|
||||
|
||||
while (container.parentNode != root) {
|
||||
if (isTextBlock(container)) {
|
||||
return container;
|
||||
}
|
||||
|
||||
if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
|
||||
return container;
|
||||
}
|
||||
|
||||
container = container.parentNode;
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
var startNode = getEndPointNode(true);
|
||||
var endNode = getEndPointNode();
|
||||
var block, siblings = [];
|
||||
|
||||
for (var node = startNode; node; node = node.nextSibling) {
|
||||
siblings.push(node);
|
||||
|
||||
if (node == endNode) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tinymce.each(siblings, function(node) {
|
||||
if (isTextBlock(node)) {
|
||||
textBlocks.push(node);
|
||||
block = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (dom.isBlock(node) || isBr(node)) {
|
||||
if (isBr(node)) {
|
||||
dom.remove(node);
|
||||
}
|
||||
|
||||
block = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var nextSibling = node.nextSibling;
|
||||
if (tinymce.dom.BookmarkManager.isBookmarkNode(node)) {
|
||||
if (isTextBlock(nextSibling) || (!nextSibling && node.parentNode == root)) {
|
||||
block = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!block) {
|
||||
block = dom.create('p');
|
||||
node.parentNode.insertBefore(block, node);
|
||||
textBlocks.push(block);
|
||||
}
|
||||
|
||||
block.appendChild(node);
|
||||
});
|
||||
|
||||
return textBlocks;
|
||||
}
|
||||
|
||||
bookmark = createBookmark(rng);
|
||||
|
||||
tinymce.each(getSelectedTextBlocks(), function(block) {
|
||||
var listBlock, sibling;
|
||||
|
||||
var hasCompatibleStyle = function (sib) {
|
||||
var sibStyle = dom.getStyle(sib, 'list-style-type');
|
||||
var detailStyle = detail ? detail['list-style-type'] : '';
|
||||
|
||||
detailStyle = detailStyle === null ? '' : detailStyle;
|
||||
|
||||
return sibStyle === detailStyle;
|
||||
};
|
||||
|
||||
sibling = block.previousSibling;
|
||||
if (sibling && isListNode(sibling) && sibling.nodeName == listName && hasCompatibleStyle(sibling)) {
|
||||
listBlock = sibling;
|
||||
block = dom.rename(block, listItemName);
|
||||
sibling.appendChild(block);
|
||||
} else {
|
||||
listBlock = dom.create(listName);
|
||||
block.parentNode.insertBefore(listBlock, block);
|
||||
listBlock.appendChild(block);
|
||||
block = dom.rename(block, listItemName);
|
||||
}
|
||||
|
||||
updateListStyle(listBlock, detail);
|
||||
mergeWithAdjacentLists(listBlock);
|
||||
});
|
||||
|
||||
moveToBookmark(bookmark);
|
||||
}
|
||||
|
||||
var updateListStyle = function (el, detail) {
|
||||
dom.setStyle(el, 'list-style-type', detail ? detail['list-style-type'] : null);
|
||||
};
|
||||
|
||||
function removeList() {
|
||||
var bookmark = createBookmark(selection.getRng(true)), root = editor.getBody();
|
||||
|
||||
tinymce.each(getSelectedListItems(), function(li) {
|
||||
var node, rootList;
|
||||
|
||||
if (isEditorBody(li.parentNode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEmpty(li)) {
|
||||
outdent(li);
|
||||
return;
|
||||
}
|
||||
|
||||
for (node = li; node && node != root; node = node.parentNode) {
|
||||
if (isListNode(node)) {
|
||||
rootList = node;
|
||||
}
|
||||
}
|
||||
|
||||
splitList(rootList, li);
|
||||
});
|
||||
|
||||
moveToBookmark(bookmark);
|
||||
}
|
||||
|
||||
function toggleList(listName, detail) {
|
||||
var parentList = dom.getParent(selection.getStart(), 'OL,UL,DL');
|
||||
|
||||
if (isEditorBody(parentList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parentList) {
|
||||
if (parentList.nodeName == listName) {
|
||||
removeList(listName);
|
||||
} else {
|
||||
var bookmark = createBookmark(selection.getRng(true));
|
||||
updateListStyle(parentList, detail);
|
||||
mergeWithAdjacentLists(dom.rename(parentList, listName));
|
||||
|
||||
moveToBookmark(bookmark);
|
||||
}
|
||||
} else {
|
||||
applyList(listName, detail);
|
||||
}
|
||||
}
|
||||
|
||||
function queryListCommandState(listName) {
|
||||
return function() {
|
||||
var parentList = dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
|
||||
|
||||
return parentList && parentList.nodeName == listName;
|
||||
};
|
||||
}
|
||||
|
||||
function isBogusBr(node) {
|
||||
if (!isBr(node)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dom.isBlock(node.nextSibling) && !isBr(node.previousSibling)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
self.backspaceDelete = function(isForward) {
|
||||
function findNextCaretContainer(rng, isForward) {
|
||||
var node = rng.startContainer, offset = rng.startOffset;
|
||||
var nonEmptyBlocks, walker;
|
||||
|
||||
if (node.nodeType == 3 && (isForward ? offset < node.data.length : offset > 0)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
nonEmptyBlocks = editor.schema.getNonEmptyElements();
|
||||
if (node.nodeType == 1) {
|
||||
node = tinymce.dom.RangeUtils.getNode(node, offset);
|
||||
}
|
||||
|
||||
walker = new tinymce.dom.TreeWalker(node, editor.getBody());
|
||||
|
||||
// Delete at <li>|<br></li> then jump over the bogus br
|
||||
if (isForward) {
|
||||
if (isBogusBr(node)) {
|
||||
walker.next();
|
||||
}
|
||||
}
|
||||
|
||||
while ((node = walker[isForward ? 'next' : 'prev2']())) {
|
||||
if (node.nodeName == 'LI' && !node.hasChildNodes()) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (nonEmptyBlocks[node.nodeName]) {
|
||||
return node;
|
||||
}
|
||||
|
||||
if (node.nodeType == 3 && node.data.length > 0) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mergeLiElements(fromElm, toElm) {
|
||||
var node, listNode, ul = fromElm.parentNode;
|
||||
|
||||
if (!isChildOfBody(fromElm) || !isChildOfBody(toElm)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isListNode(toElm.lastChild)) {
|
||||
listNode = toElm.lastChild;
|
||||
}
|
||||
|
||||
if (ul == toElm.lastChild) {
|
||||
if (isBr(ul.previousSibling)) {
|
||||
dom.remove(ul.previousSibling);
|
||||
}
|
||||
}
|
||||
|
||||
node = toElm.lastChild;
|
||||
if (node && isBr(node) && fromElm.hasChildNodes()) {
|
||||
dom.remove(node);
|
||||
}
|
||||
|
||||
if (isEmpty(toElm, true)) {
|
||||
dom.$(toElm).empty();
|
||||
}
|
||||
|
||||
if (!isEmpty(fromElm, true)) {
|
||||
while ((node = fromElm.firstChild)) {
|
||||
toElm.appendChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
if (listNode) {
|
||||
toElm.appendChild(listNode);
|
||||
}
|
||||
|
||||
dom.remove(fromElm);
|
||||
|
||||
if (isEmpty(ul) && !isEditorBody(ul)) {
|
||||
dom.remove(ul);
|
||||
}
|
||||
}
|
||||
|
||||
if (selection.isCollapsed()) {
|
||||
var li = dom.getParent(selection.getStart(), 'LI'), ul, rng, otherLi;
|
||||
|
||||
if (li) {
|
||||
ul = li.parentNode;
|
||||
if (isEditorBody(ul) && dom.isEmpty(ul)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
rng = selection.getRng(true);
|
||||
otherLi = dom.getParent(findNextCaretContainer(rng, isForward), 'LI');
|
||||
|
||||
if (otherLi && otherLi != li) {
|
||||
var bookmark = createBookmark(rng);
|
||||
|
||||
if (isForward) {
|
||||
mergeLiElements(otherLi, li);
|
||||
} else {
|
||||
mergeLiElements(li, otherLi);
|
||||
}
|
||||
|
||||
moveToBookmark(bookmark);
|
||||
|
||||
return true;
|
||||
} else if (!otherLi) {
|
||||
if (!isForward && removeList(ul.nodeName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
editor.on('BeforeExecCommand', function(e) {
|
||||
var cmd = e.command.toLowerCase(), isHandled;
|
||||
|
||||
if (cmd == "indent") {
|
||||
if (indentSelection()) {
|
||||
isHandled = true;
|
||||
}
|
||||
} else if (cmd == "outdent") {
|
||||
if (outdentSelection()) {
|
||||
isHandled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isHandled) {
|
||||
editor.fire('ExecCommand', {command: e.command});
|
||||
e.preventDefault();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
editor.addCommand('InsertUnorderedList', function(ui, detail) {
|
||||
toggleList('UL', detail);
|
||||
});
|
||||
|
||||
editor.addCommand('InsertOrderedList', function(ui, detail) {
|
||||
toggleList('OL', detail);
|
||||
});
|
||||
|
||||
editor.addCommand('InsertDefinitionList', function(ui, detail) {
|
||||
toggleList('DL', detail);
|
||||
});
|
||||
|
||||
editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState('UL'));
|
||||
editor.addQueryStateHandler('InsertOrderedList', queryListCommandState('OL'));
|
||||
editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState('DL'));
|
||||
|
||||
editor.on('keydown', function(e) {
|
||||
// Check for tab but not ctrl/cmd+tab since it switches browser tabs
|
||||
if (e.keyCode != 9 || tinymce.util.VK.metaKeyPressed(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD')) {
|
||||
e.preventDefault();
|
||||
|
||||
if (e.shiftKey) {
|
||||
outdentSelection();
|
||||
} else {
|
||||
indentSelection();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editor.addButton('indent', {
|
||||
icon: 'indent',
|
||||
title: 'Increase indent',
|
||||
cmd: 'Indent',
|
||||
onPostRender: function() {
|
||||
var ctrl = this;
|
||||
|
||||
editor.on('nodechange', function() {
|
||||
var blocks = editor.selection.getSelectedBlocks();
|
||||
var disable = false;
|
||||
|
||||
for (var i = 0, l = blocks.length; !disable && i < l; i++) {
|
||||
var tag = blocks[i].nodeName;
|
||||
|
||||
disable = (tag == 'LI' && isFirstChild(blocks[i]) || tag == 'UL' || tag == 'OL' || tag == 'DD');
|
||||
}
|
||||
|
||||
ctrl.disabled(disable);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('keydown', function(e) {
|
||||
if (e.keyCode == tinymce.util.VK.BACKSPACE) {
|
||||
if (self.backspaceDelete()) {
|
||||
e.preventDefault();
|
||||
}
|
||||
} else if (e.keyCode == tinymce.util.VK.DELETE) {
|
||||
if (self.backspaceDelete(true)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/lists/plugin.min.js
vendored
Normal file
BIN
assets/dashboard/plugins/tinymce/plugins/media/moxieplayer.swf
Normal file
879
assets/dashboard/plugins/tinymce/plugins/media/plugin.js
Normal file
@@ -0,0 +1,879 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*jshint maxlen:255 */
|
||||
/*eslint max-len:0 */
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('media', function(editor, url) {
|
||||
var urlPatterns = [
|
||||
{regex: /youtu\.be\/([\w\-.]+)/, type: 'iframe', w: 560, h: 314, url: '//www.youtube.com/embed/$1', allowFullscreen: true},
|
||||
{regex: /youtube\.com(.+)v=([^&]+)/, type: 'iframe', w: 560, h: 314, url: '//www.youtube.com/embed/$2', allowFullscreen: true},
|
||||
{regex: /youtube.com\/embed\/([a-z0-9\-_]+(?:\?.+)?)/i, type: 'iframe', w: 560, h: 314, url: '//www.youtube.com/embed/$1', allowFullscreen: true},
|
||||
{regex: /vimeo\.com\/([0-9]+)/, type: 'iframe', w: 425, h: 350, url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc', allowfullscreen: true},
|
||||
{regex: /vimeo\.com\/(.*)\/([0-9]+)/, type: "iframe", w: 425, h: 350, url: "//player.vimeo.com/video/$2?title=0&byline=0", allowfullscreen: true},
|
||||
{regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: 'iframe', w: 425, h: 350, url: '//maps.google.com/maps/ms?msid=$2&output=embed"', allowFullscreen: false},
|
||||
{regex: /dailymotion\.com\/video\/([^_]+)/, type: 'iframe', w: 480, h: 270, url: '//www.dailymotion.com/embed/video/$1', allowFullscreen: true}
|
||||
];
|
||||
|
||||
var embedChange = (tinymce.Env.ie && tinymce.Env.ie <= 8) ? 'onChange' : 'onInput';
|
||||
|
||||
function guessMime(url) {
|
||||
url = url.toLowerCase();
|
||||
|
||||
if (url.indexOf('.mp3') != -1) {
|
||||
return 'audio/mpeg';
|
||||
}
|
||||
|
||||
if (url.indexOf('.wav') != -1) {
|
||||
return 'audio/wav';
|
||||
}
|
||||
|
||||
if (url.indexOf('.mp4') != -1) {
|
||||
return 'video/mp4';
|
||||
}
|
||||
|
||||
if (url.indexOf('.webm') != -1) {
|
||||
return 'video/webm';
|
||||
}
|
||||
|
||||
if (url.indexOf('.ogg') != -1) {
|
||||
return 'video/ogg';
|
||||
}
|
||||
|
||||
if (url.indexOf('.swf') != -1) {
|
||||
return 'application/x-shockwave-flash';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function getVideoScriptMatch(src) {
|
||||
var prefixes = editor.settings.media_scripts;
|
||||
|
||||
if (prefixes) {
|
||||
for (var i = 0; i < prefixes.length; i++) {
|
||||
if (src.indexOf(prefixes[i].filter) !== -1) {
|
||||
return prefixes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showDialog() {
|
||||
var win, width, height, data;
|
||||
|
||||
var generalFormItems = [
|
||||
{
|
||||
name: 'source1',
|
||||
type: 'filepicker',
|
||||
filetype: 'media',
|
||||
size: 40,
|
||||
autofocus: true,
|
||||
label: 'Source',
|
||||
onchange: function(e) {
|
||||
tinymce.each(e.meta, function(value, key) {
|
||||
win.find('#' + key).value(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
function recalcSize(e) {
|
||||
var widthCtrl, heightCtrl, newWidth, newHeight;
|
||||
|
||||
widthCtrl = win.find('#width')[0];
|
||||
heightCtrl = win.find('#height')[0];
|
||||
|
||||
newWidth = widthCtrl.value();
|
||||
newHeight = heightCtrl.value();
|
||||
|
||||
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
|
||||
if (e.control == widthCtrl) {
|
||||
newHeight = Math.round((newWidth / width) * newHeight);
|
||||
|
||||
if (!isNaN(newHeight)) {
|
||||
heightCtrl.value(newHeight);
|
||||
}
|
||||
} else {
|
||||
newWidth = Math.round((newHeight / height) * newWidth);
|
||||
|
||||
if (!isNaN(newWidth)) {
|
||||
widthCtrl.value(newWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
}
|
||||
|
||||
if (editor.settings.media_alt_source !== false) {
|
||||
generalFormItems.push({name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source'});
|
||||
}
|
||||
|
||||
if (editor.settings.media_poster !== false) {
|
||||
generalFormItems.push({name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster'});
|
||||
}
|
||||
|
||||
if (editor.settings.media_dimensions !== false) {
|
||||
generalFormItems.push({
|
||||
type: 'container',
|
||||
label: 'Dimensions',
|
||||
layout: 'flex',
|
||||
align: 'center',
|
||||
spacing: 5,
|
||||
items: [
|
||||
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width'},
|
||||
{type: 'label', text: 'x'},
|
||||
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height'},
|
||||
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
data = getData(editor.selection.getNode());
|
||||
width = data.width;
|
||||
height = data.height;
|
||||
|
||||
var embedTextBox = {
|
||||
id: 'mcemediasource',
|
||||
type: 'textbox',
|
||||
flex: 1,
|
||||
name: 'embed',
|
||||
value: getSource(),
|
||||
multiline: true,
|
||||
label: 'Source'
|
||||
};
|
||||
|
||||
function updateValueOnChange() {
|
||||
data = htmlToData(this.value());
|
||||
this.parent().parent().fromJSON(data);
|
||||
}
|
||||
|
||||
embedTextBox[embedChange] = updateValueOnChange;
|
||||
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert/edit video',
|
||||
data: data,
|
||||
bodyType: 'tabpanel',
|
||||
body: [
|
||||
{
|
||||
title: 'General',
|
||||
type: "form",
|
||||
onShowTab: function() {
|
||||
data = htmlToData(this.next().find('#embed').value());
|
||||
this.fromJSON(data);
|
||||
},
|
||||
items: generalFormItems
|
||||
},
|
||||
|
||||
{
|
||||
title: 'Embed',
|
||||
type: "container",
|
||||
layout: 'flex',
|
||||
direction: 'column',
|
||||
align: 'stretch',
|
||||
padding: 10,
|
||||
spacing: 10,
|
||||
onShowTab: function() {
|
||||
this.find('#embed').value(dataToHtml(this.parent().toJSON()));
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'label',
|
||||
text: 'Paste your embed code below:',
|
||||
forId: 'mcemediasource'
|
||||
},
|
||||
embedTextBox
|
||||
]
|
||||
}
|
||||
],
|
||||
onSubmit: function() {
|
||||
var beforeObjects, afterObjects, i, y;
|
||||
|
||||
beforeObjects = editor.dom.select('img[data-mce-object]');
|
||||
editor.insertContent(dataToHtml(this.toJSON()));
|
||||
afterObjects = editor.dom.select('img[data-mce-object]');
|
||||
|
||||
// Find new image placeholder so we can select it
|
||||
for (i = 0; i < beforeObjects.length; i++) {
|
||||
for (y = afterObjects.length - 1; y >= 0; y--) {
|
||||
if (beforeObjects[i] == afterObjects[y]) {
|
||||
afterObjects.splice(y, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editor.selection.select(afterObjects[0]);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getSource() {
|
||||
var elm = editor.selection.getNode();
|
||||
|
||||
if (elm.getAttribute('data-mce-object')) {
|
||||
return editor.selection.getContent();
|
||||
}
|
||||
}
|
||||
|
||||
function dataToHtml(data) {
|
||||
var html = '';
|
||||
|
||||
if (!data.source1) {
|
||||
tinymce.extend(data, htmlToData(data.embed));
|
||||
if (!data.source1) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!data.source2) {
|
||||
data.source2 = '';
|
||||
}
|
||||
|
||||
if (!data.poster) {
|
||||
data.poster = '';
|
||||
}
|
||||
|
||||
data.source1 = editor.convertURL(data.source1, "source");
|
||||
data.source2 = editor.convertURL(data.source2, "source");
|
||||
data.source1mime = guessMime(data.source1);
|
||||
data.source2mime = guessMime(data.source2);
|
||||
data.poster = editor.convertURL(data.poster, "poster");
|
||||
data.flashPlayerUrl = editor.convertURL(url + '/moxieplayer.swf', "movie");
|
||||
|
||||
tinymce.each(urlPatterns, function(pattern) {
|
||||
var match, i, url;
|
||||
|
||||
if ((match = pattern.regex.exec(data.source1))) {
|
||||
url = pattern.url;
|
||||
|
||||
for (i = 0; match[i]; i++) {
|
||||
/*jshint loopfunc:true*/
|
||||
/*eslint no-loop-func:0 */
|
||||
url = url.replace('$' + i, function() {
|
||||
return match[i];
|
||||
});
|
||||
}
|
||||
|
||||
data.source1 = url;
|
||||
data.type = pattern.type;
|
||||
data.allowFullscreen = pattern.allowFullscreen;
|
||||
data.width = data.width || pattern.w;
|
||||
data.height = data.height || pattern.h;
|
||||
}
|
||||
});
|
||||
|
||||
if (data.embed) {
|
||||
html = updateHtml(data.embed, data, true);
|
||||
} else {
|
||||
var videoScript = getVideoScriptMatch(data.source1);
|
||||
if (videoScript) {
|
||||
data.type = 'script';
|
||||
data.width = videoScript.width;
|
||||
data.height = videoScript.height;
|
||||
}
|
||||
|
||||
data.width = data.width || 300;
|
||||
data.height = data.height || 150;
|
||||
|
||||
tinymce.each(data, function(value, key) {
|
||||
data[key] = editor.dom.encode(value);
|
||||
});
|
||||
|
||||
if (data.type == "iframe") {
|
||||
var allowFullscreen = data.allowFullscreen ? ' allowFullscreen="1"' : '';
|
||||
html += '<iframe src="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '"' + allowFullscreen + '></iframe>';
|
||||
} else if (data.source1mime == "application/x-shockwave-flash") {
|
||||
html += '<object data="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
|
||||
|
||||
if (data.poster) {
|
||||
html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
|
||||
}
|
||||
|
||||
html += '</object>';
|
||||
} else if (data.source1mime.indexOf('audio') != -1) {
|
||||
if (editor.settings.audio_template_callback) {
|
||||
html = editor.settings.audio_template_callback(data);
|
||||
} else {
|
||||
html += (
|
||||
'<audio controls="controls" src="' + data.source1 + '">' +
|
||||
(data.source2 ? '\n<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
|
||||
'</audio>'
|
||||
);
|
||||
}
|
||||
} else if (data.type == "script") {
|
||||
html += '<script src="' + data.source1 + '"></script>';
|
||||
} else {
|
||||
if (editor.settings.video_template_callback) {
|
||||
html = editor.settings.video_template_callback(data);
|
||||
} else {
|
||||
html = (
|
||||
'<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
|
||||
'<source src="' + data.source1 + '"' + (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
|
||||
(data.source2 ? '<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
|
||||
'</video>'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function htmlToData(html) {
|
||||
var data = {};
|
||||
|
||||
new tinymce.html.SaxParser({
|
||||
validate: false,
|
||||
allow_conditional_comments: true,
|
||||
special: 'script,noscript',
|
||||
start: function(name, attrs) {
|
||||
if (!data.source1 && name == "param") {
|
||||
data.source1 = attrs.map.movie;
|
||||
}
|
||||
|
||||
if (name == "iframe" || name == "object" || name == "embed" || name == "video" || name == "audio") {
|
||||
if (!data.type) {
|
||||
data.type = name;
|
||||
}
|
||||
|
||||
data = tinymce.extend(attrs.map, data);
|
||||
}
|
||||
|
||||
if (name == "script") {
|
||||
var videoScript = getVideoScriptMatch(attrs.map.src);
|
||||
if (!videoScript) {
|
||||
return;
|
||||
}
|
||||
|
||||
data = {
|
||||
type: "script",
|
||||
source1: attrs.map.src,
|
||||
width: videoScript.width,
|
||||
height: videoScript.height
|
||||
};
|
||||
}
|
||||
|
||||
if (name == "source") {
|
||||
if (!data.source1) {
|
||||
data.source1 = attrs.map.src;
|
||||
} else if (!data.source2) {
|
||||
data.source2 = attrs.map.src;
|
||||
}
|
||||
}
|
||||
|
||||
if (name == "img" && !data.poster) {
|
||||
data.poster = attrs.map.src;
|
||||
}
|
||||
}
|
||||
}).parse(html);
|
||||
|
||||
data.source1 = data.source1 || data.src || data.data;
|
||||
data.source2 = data.source2 || '';
|
||||
data.poster = data.poster || '';
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function getData(element) {
|
||||
if (element.getAttribute('data-mce-object')) {
|
||||
return htmlToData(editor.serializer.serialize(element, {selection: true}));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
function sanitize(html) {
|
||||
if (editor.settings.media_filter_html === false) {
|
||||
return html;
|
||||
}
|
||||
|
||||
var writer = new tinymce.html.Writer(), blocked;
|
||||
|
||||
new tinymce.html.SaxParser({
|
||||
validate: false,
|
||||
allow_conditional_comments: false,
|
||||
special: 'script,noscript',
|
||||
|
||||
comment: function(text) {
|
||||
writer.comment(text);
|
||||
},
|
||||
|
||||
cdata: function(text) {
|
||||
writer.cdata(text);
|
||||
},
|
||||
|
||||
text: function(text, raw) {
|
||||
writer.text(text, raw);
|
||||
},
|
||||
|
||||
start: function(name, attrs, empty) {
|
||||
blocked = true;
|
||||
|
||||
if (name == 'script' || name == 'noscript') {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
if (attrs[i].name.indexOf('on') === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (attrs[i].name == 'style') {
|
||||
attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
|
||||
}
|
||||
}
|
||||
|
||||
writer.start(name, attrs, empty);
|
||||
blocked = false;
|
||||
},
|
||||
|
||||
end: function(name) {
|
||||
if (blocked) {
|
||||
return;
|
||||
}
|
||||
|
||||
writer.end(name);
|
||||
}
|
||||
}, new tinymce.html.Schema({})).parse(html);
|
||||
|
||||
return writer.getContent();
|
||||
}
|
||||
|
||||
function updateHtml(html, data, updateAll) {
|
||||
var writer = new tinymce.html.Writer();
|
||||
var sourceCount = 0, hasImage;
|
||||
|
||||
function setAttributes(attrs, updatedAttrs) {
|
||||
var name, i, value, attr;
|
||||
|
||||
for (name in updatedAttrs) {
|
||||
value = "" + updatedAttrs[name];
|
||||
|
||||
if (attrs.map[name]) {
|
||||
i = attrs.length;
|
||||
while (i--) {
|
||||
attr = attrs[i];
|
||||
|
||||
if (attr.name == name) {
|
||||
if (value) {
|
||||
attrs.map[name] = value;
|
||||
attr.value = value;
|
||||
} else {
|
||||
delete attrs.map[name];
|
||||
attrs.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (value) {
|
||||
attrs.push({
|
||||
name: name,
|
||||
value: value
|
||||
});
|
||||
|
||||
attrs.map[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new tinymce.html.SaxParser({
|
||||
validate: false,
|
||||
allow_conditional_comments: true,
|
||||
special: 'script,noscript',
|
||||
|
||||
comment: function(text) {
|
||||
writer.comment(text);
|
||||
},
|
||||
|
||||
cdata: function(text) {
|
||||
writer.cdata(text);
|
||||
},
|
||||
|
||||
text: function(text, raw) {
|
||||
writer.text(text, raw);
|
||||
},
|
||||
|
||||
start: function(name, attrs, empty) {
|
||||
switch (name) {
|
||||
case "video":
|
||||
case "object":
|
||||
case "embed":
|
||||
case "img":
|
||||
case "iframe":
|
||||
setAttributes(attrs, {
|
||||
width: data.width,
|
||||
height: data.height
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
if (updateAll) {
|
||||
switch (name) {
|
||||
case "video":
|
||||
setAttributes(attrs, {
|
||||
poster: data.poster,
|
||||
src: ""
|
||||
});
|
||||
|
||||
if (data.source2) {
|
||||
setAttributes(attrs, {
|
||||
src: ""
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case "iframe":
|
||||
setAttributes(attrs, {
|
||||
src: data.source1
|
||||
});
|
||||
break;
|
||||
|
||||
case "source":
|
||||
sourceCount++;
|
||||
|
||||
if (sourceCount <= 2) {
|
||||
setAttributes(attrs, {
|
||||
src: data["source" + sourceCount],
|
||||
type: data["source" + sourceCount + "mime"]
|
||||
});
|
||||
|
||||
if (!data["source" + sourceCount]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "img":
|
||||
if (!data.poster) {
|
||||
return;
|
||||
}
|
||||
|
||||
hasImage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
writer.start(name, attrs, empty);
|
||||
},
|
||||
|
||||
end: function(name) {
|
||||
if (name == "video" && updateAll) {
|
||||
for (var index = 1; index <= 2; index++) {
|
||||
if (data["source" + index]) {
|
||||
var attrs = [];
|
||||
attrs.map = {};
|
||||
|
||||
if (sourceCount < index) {
|
||||
setAttributes(attrs, {
|
||||
src: data["source" + index],
|
||||
type: data["source" + index + "mime"]
|
||||
});
|
||||
|
||||
writer.start("source", attrs, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.poster && name == "object" && updateAll && !hasImage) {
|
||||
var imgAttrs = [];
|
||||
imgAttrs.map = {};
|
||||
|
||||
setAttributes(imgAttrs, {
|
||||
src: data.poster,
|
||||
width: data.width,
|
||||
height: data.height
|
||||
});
|
||||
|
||||
writer.start("img", imgAttrs, true);
|
||||
}
|
||||
|
||||
writer.end(name);
|
||||
}
|
||||
}, new tinymce.html.Schema({})).parse(html);
|
||||
|
||||
return writer.getContent();
|
||||
}
|
||||
|
||||
editor.on('ResolveName', function(e) {
|
||||
var name;
|
||||
|
||||
if (e.target.nodeType == 1 && (name = e.target.getAttribute("data-mce-object"))) {
|
||||
e.name = name;
|
||||
}
|
||||
});
|
||||
|
||||
function retainAttributesAndInnerHtml(sourceNode, targetNode) {
|
||||
var attrName, attrValue, attribs, ai, innerHtml;
|
||||
|
||||
// Prefix all attributes except width, height and style since we
|
||||
// will add these to the placeholder
|
||||
attribs = sourceNode.attributes;
|
||||
ai = attribs.length;
|
||||
while (ai--) {
|
||||
attrName = attribs[ai].name;
|
||||
attrValue = attribs[ai].value;
|
||||
|
||||
if (attrName !== "width" && attrName !== "height" && attrName !== "style") {
|
||||
if (attrName == "data" || attrName == "src") {
|
||||
attrValue = editor.convertURL(attrValue, attrName);
|
||||
}
|
||||
|
||||
targetNode.attr('data-mce-p-' + attrName, attrValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Place the inner HTML contents inside an escaped attribute
|
||||
// This enables us to copy/paste the fake object
|
||||
innerHtml = sourceNode.firstChild && sourceNode.firstChild.value;
|
||||
if (innerHtml) {
|
||||
targetNode.attr("data-mce-html", escape(innerHtml));
|
||||
targetNode.firstChild = null;
|
||||
}
|
||||
}
|
||||
|
||||
function createPlaceholderNode(node) {
|
||||
var placeHolder, name = node.name;
|
||||
|
||||
placeHolder = new tinymce.html.Node('img', 1);
|
||||
placeHolder.shortEnded = true;
|
||||
|
||||
retainAttributesAndInnerHtml(node, placeHolder);
|
||||
|
||||
placeHolder.attr({
|
||||
width: node.attr('width') || "300",
|
||||
height: node.attr('height') || (name == "audio" ? "30" : "150"),
|
||||
style: node.attr('style'),
|
||||
src: tinymce.Env.transparentSrc,
|
||||
"data-mce-object": name,
|
||||
"class": "mce-object mce-object-" + name
|
||||
});
|
||||
|
||||
return placeHolder;
|
||||
}
|
||||
|
||||
function createPreviewNode(node) {
|
||||
var previewWrapper, previewNode, shimNode, name = node.name;
|
||||
|
||||
previewWrapper = new tinymce.html.Node('span', 1);
|
||||
previewWrapper.attr({
|
||||
contentEditable: 'false',
|
||||
style: node.attr('style'),
|
||||
"data-mce-object": name,
|
||||
"class": "mce-preview-object mce-object-" + name
|
||||
});
|
||||
|
||||
retainAttributesAndInnerHtml(node, previewWrapper);
|
||||
|
||||
previewNode = new tinymce.html.Node(name, 1);
|
||||
previewNode.attr({
|
||||
src: node.attr('src'),
|
||||
allowfullscreen: node.attr('allowfullscreen'),
|
||||
width: node.attr('width') || "300",
|
||||
height: node.attr('height') || (name == "audio" ? "30" : "150"),
|
||||
frameborder: '0'
|
||||
});
|
||||
|
||||
shimNode = new tinymce.html.Node('span', 1);
|
||||
shimNode.attr('class', 'mce-shim');
|
||||
|
||||
previewWrapper.append(previewNode);
|
||||
previewWrapper.append(shimNode);
|
||||
|
||||
return previewWrapper;
|
||||
}
|
||||
|
||||
editor.on('preInit', function() {
|
||||
// Make sure that any messy HTML is retained inside these
|
||||
var specialElements = editor.schema.getSpecialElements();
|
||||
tinymce.each('video audio iframe object'.split(' '), function(name) {
|
||||
specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
|
||||
});
|
||||
|
||||
// Allow elements
|
||||
//editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]');
|
||||
|
||||
// Set allowFullscreen attribs as boolean
|
||||
var boolAttrs = editor.schema.getBoolAttrs();
|
||||
tinymce.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function(name) {
|
||||
boolAttrs[name] = {};
|
||||
});
|
||||
|
||||
// Converts iframe, video etc into placeholder images
|
||||
editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', function(nodes) {
|
||||
var i = nodes.length, node, placeHolder, videoScript;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if (!node.parent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (node.parent.attr('data-mce-object')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (node.name == 'script') {
|
||||
videoScript = getVideoScriptMatch(node.attr('src'));
|
||||
if (!videoScript) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (videoScript) {
|
||||
if (videoScript.width) {
|
||||
node.attr('width', videoScript.width.toString());
|
||||
}
|
||||
|
||||
if (videoScript.height) {
|
||||
node.attr('height', videoScript.height.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (node.name == 'iframe' && editor.settings.media_live_embeds !== false && tinymce.Env.ceFalse) {
|
||||
placeHolder = createPreviewNode(node);
|
||||
} else {
|
||||
placeHolder = createPlaceholderNode(node);
|
||||
}
|
||||
|
||||
node.replace(placeHolder);
|
||||
}
|
||||
});
|
||||
|
||||
// Replaces placeholder images with real elements for video, object, iframe etc
|
||||
editor.serializer.addAttributeFilter('data-mce-object', function(nodes, name) {
|
||||
var i = nodes.length, node, realElm, ai, attribs, innerHtml, innerNode, realElmName, className;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if (!node.parent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
realElmName = node.attr(name);
|
||||
realElm = new tinymce.html.Node(realElmName, 1);
|
||||
|
||||
// Add width/height to everything but audio
|
||||
if (realElmName != "audio" && realElmName != "script") {
|
||||
className = node.attr('class');
|
||||
if (className && className.indexOf('mce-preview-object') !== -1) {
|
||||
realElm.attr({
|
||||
width: node.firstChild.attr('width'),
|
||||
height: node.firstChild.attr('height')
|
||||
});
|
||||
} else {
|
||||
realElm.attr({
|
||||
width: node.attr('width'),
|
||||
height: node.attr('height')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
realElm.attr({
|
||||
style: node.attr('style')
|
||||
});
|
||||
|
||||
// Unprefix all placeholder attributes
|
||||
attribs = node.attributes;
|
||||
ai = attribs.length;
|
||||
while (ai--) {
|
||||
var attrName = attribs[ai].name;
|
||||
|
||||
if (attrName.indexOf('data-mce-p-') === 0) {
|
||||
realElm.attr(attrName.substr(11), attribs[ai].value);
|
||||
}
|
||||
}
|
||||
|
||||
if (realElmName == "script") {
|
||||
realElm.attr('type', 'text/javascript');
|
||||
}
|
||||
|
||||
// Inject innerhtml
|
||||
innerHtml = node.attr('data-mce-html');
|
||||
if (innerHtml) {
|
||||
innerNode = new tinymce.html.Node('#text', 3);
|
||||
innerNode.raw = true;
|
||||
innerNode.value = sanitize(unescape(innerHtml));
|
||||
realElm.append(innerNode);
|
||||
}
|
||||
|
||||
node.replace(realElm);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editor.on('click keyup', function() {
|
||||
var selectedNode = editor.selection.getNode();
|
||||
|
||||
if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) {
|
||||
if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) {
|
||||
selectedNode.setAttribute('data-mce-selected', '2');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('ObjectSelected', function(e) {
|
||||
var objectType = e.target.getAttribute('data-mce-object');
|
||||
|
||||
if (objectType == "audio" || objectType == "script") {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('objectResized', function(e) {
|
||||
var target = e.target, html;
|
||||
|
||||
if (target.getAttribute('data-mce-object')) {
|
||||
html = target.getAttribute('data-mce-html');
|
||||
if (html) {
|
||||
html = unescape(html);
|
||||
target.setAttribute('data-mce-html', escape(
|
||||
updateHtml(html, {
|
||||
width: e.width,
|
||||
height: e.height
|
||||
})
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.addButton('media', {
|
||||
tooltip: 'Insert/edit video',
|
||||
onclick: showDialog,
|
||||
stateSelector: ['img[data-mce-object]', 'span[data-mce-object]']
|
||||
});
|
||||
|
||||
editor.addMenuItem('media', {
|
||||
icon: 'media',
|
||||
text: 'Insert/edit video',
|
||||
onclick: showDialog,
|
||||
context: 'insert',
|
||||
prependToContext: true
|
||||
});
|
||||
|
||||
editor.on('setContent', function() {
|
||||
// TODO: This shouldn't be needed there should be a way to mark bogus
|
||||
// elements so they are never removed except external save
|
||||
editor.$('span.mce-preview-object').each(function(index, elm) {
|
||||
var $elm = editor.$(elm);
|
||||
|
||||
if ($elm.find('span.mce-shim', elm).length === 0) {
|
||||
$elm.append('<span class="mce-shim"></span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editor.addCommand('mceMedia', showDialog);
|
||||
|
||||
this.showDialog = showDialog;
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/media/plugin.min.js
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('nonbreaking', function(editor) {
|
||||
var setting = editor.getParam('nonbreaking_force_tab');
|
||||
|
||||
editor.addCommand('mceNonBreaking', function() {
|
||||
editor.insertContent(
|
||||
(editor.plugins.visualchars && editor.plugins.visualchars.state) ?
|
||||
'<span class="mce-nbsp"> </span>' : ' '
|
||||
);
|
||||
|
||||
editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1');
|
||||
});
|
||||
|
||||
editor.addButton('nonbreaking', {
|
||||
title: 'Nonbreaking space',
|
||||
cmd: 'mceNonBreaking'
|
||||
});
|
||||
|
||||
editor.addMenuItem('nonbreaking', {
|
||||
text: 'Nonbreaking space',
|
||||
cmd: 'mceNonBreaking',
|
||||
context: 'insert'
|
||||
});
|
||||
|
||||
if (setting) {
|
||||
var spaces = +setting > 1 ? +setting : 3; // defaults to 3 spaces if setting is true (or 1)
|
||||
|
||||
editor.on('keydown', function(e) {
|
||||
if (e.keyCode == 9) {
|
||||
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
for (var i = 0; i < spaces; i++) {
|
||||
editor.execCommand('mceNonBreaking');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/nonbreaking/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("nonbreaking",function(a){var b=a.getParam("nonbreaking_force_tab");if(a.addCommand("mceNonBreaking",function(){a.insertContent(a.plugins.visualchars&&a.plugins.visualchars.state?'<span class="mce-nbsp"> </span>':" "),a.dom.setAttrib(a.dom.select("span.mce-nbsp"),"data-mce-bogus","1")}),a.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),a.addMenuItem("nonbreaking",{text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"}),b){var c=+b>1?+b:3;a.on("keydown",function(b){if(9==b.keyCode){if(b.shiftKey)return;b.preventDefault();for(var d=0;c>d;d++)a.execCommand("mceNonBreaking")}})}});
|
||||
101
assets/dashboard/plugins/tinymce/plugins/noneditable/plugin.js
Normal file
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('noneditable', function(editor) {
|
||||
var editClass, nonEditClass, nonEditableRegExps, contentEditableAttrName = 'contenteditable';
|
||||
|
||||
function hasClass(checkClassName) {
|
||||
return function(node) {
|
||||
return (" " + node.attr("class") + " ").indexOf(checkClassName) !== -1;
|
||||
};
|
||||
}
|
||||
|
||||
function convertRegExpsToNonEditable(e) {
|
||||
var i = nonEditableRegExps.length, content = e.content, cls = tinymce.trim(nonEditClass);
|
||||
|
||||
function replaceMatchWithSpan(match) {
|
||||
var args = arguments, index = args[args.length - 2];
|
||||
|
||||
// Is value inside an attribute then don't replace
|
||||
if (index > 0 && content.charAt(index - 1) == '"') {
|
||||
return match;
|
||||
}
|
||||
|
||||
return (
|
||||
'<span class="' + cls + '" data-mce-content="' + editor.dom.encode(args[0]) + '">' +
|
||||
editor.dom.encode(typeof args[1] === "string" ? args[1] : args[0]) + '</span>'
|
||||
);
|
||||
}
|
||||
|
||||
// Don't replace the variables when raw is used for example on undo/redo
|
||||
if (e.format == "raw") {
|
||||
return;
|
||||
}
|
||||
|
||||
while (i--) {
|
||||
content = content.replace(nonEditableRegExps[i], replaceMatchWithSpan);
|
||||
}
|
||||
|
||||
e.content = content;
|
||||
}
|
||||
|
||||
editClass = " " + tinymce.trim(editor.getParam("noneditable_editable_class", "mceEditable")) + " ";
|
||||
nonEditClass = " " + tinymce.trim(editor.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
|
||||
|
||||
var hasEditClass = hasClass(editClass);
|
||||
var hasNonEditClass = hasClass(nonEditClass);
|
||||
|
||||
nonEditableRegExps = editor.getParam("noneditable_regexp");
|
||||
if (nonEditableRegExps && !nonEditableRegExps.length) {
|
||||
nonEditableRegExps = [nonEditableRegExps];
|
||||
}
|
||||
|
||||
editor.on('PreInit', function() {
|
||||
if (nonEditableRegExps) {
|
||||
editor.on('BeforeSetContent', convertRegExpsToNonEditable);
|
||||
}
|
||||
|
||||
editor.parser.addAttributeFilter('class', function(nodes) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
|
||||
if (hasEditClass(node)) {
|
||||
node.attr(contentEditableAttrName, "true");
|
||||
} else if (hasNonEditClass(node)) {
|
||||
node.attr(contentEditableAttrName, "false");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.serializer.addAttributeFilter(contentEditableAttrName, function(nodes) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if (!hasEditClass(node) && !hasNonEditClass(node)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nonEditableRegExps && node.attr('data-mce-content')) {
|
||||
node.name = "#text";
|
||||
node.type = 3;
|
||||
node.raw = true;
|
||||
node.value = node.attr('data-mce-content');
|
||||
} else {
|
||||
node.attr(contentEditableAttrName, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/noneditable/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("noneditable",function(a){function b(a){return function(b){return-1!==(" "+b.attr("class")+" ").indexOf(a)}}function c(b){function c(b){var c=arguments,d=c[c.length-2];return d>0&&'"'==g.charAt(d-1)?b:'<span class="'+h+'" data-mce-content="'+a.dom.encode(c[0])+'">'+a.dom.encode("string"==typeof c[1]?c[1]:c[0])+"</span>"}var d=f.length,g=b.content,h=tinymce.trim(e);if("raw"!=b.format){for(;d--;)g=g.replace(f[d],c);b.content=g}}var d,e,f,g="contenteditable";d=" "+tinymce.trim(a.getParam("noneditable_editable_class","mceEditable"))+" ",e=" "+tinymce.trim(a.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";var h=b(d),i=b(e);f=a.getParam("noneditable_regexp"),f&&!f.length&&(f=[f]),a.on("PreInit",function(){f&&a.on("BeforeSetContent",c),a.parser.addAttributeFilter("class",function(a){for(var b,c=a.length;c--;)b=a[c],h(b)?b.attr(g,"true"):i(b)&&b.attr(g,"false")}),a.serializer.addAttributeFilter(g,function(a){for(var b,c=a.length;c--;)b=a[c],(h(b)||i(b))&&(f&&b.attr("data-mce-content")?(b.name="#text",b.type=3,b.raw=!0,b.value=b.attr("data-mce-content")):b.attr(g,null))})})});
|
||||
88
assets/dashboard/plugins/tinymce/plugins/pagebreak/plugin.js
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('pagebreak', function(editor) {
|
||||
var pageBreakClass = 'mce-pagebreak', separatorHtml = editor.getParam('pagebreak_separator', '<!-- pagebreak -->');
|
||||
|
||||
var pageBreakSeparatorRegExp = new RegExp(separatorHtml.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {
|
||||
return '\\' + a;
|
||||
}), 'gi');
|
||||
|
||||
var pageBreakPlaceHolderHtml = '<img src="' + tinymce.Env.transparentSrc + '" class="' +
|
||||
pageBreakClass + '" data-mce-resize="false" data-mce-placeholder />';
|
||||
|
||||
// Register commands
|
||||
editor.addCommand('mcePageBreak', function() {
|
||||
if (editor.settings.pagebreak_split_block) {
|
||||
editor.insertContent('<p>' + pageBreakPlaceHolderHtml + '</p>');
|
||||
} else {
|
||||
editor.insertContent(pageBreakPlaceHolderHtml);
|
||||
}
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
editor.addButton('pagebreak', {
|
||||
title: 'Page break',
|
||||
cmd: 'mcePageBreak'
|
||||
});
|
||||
|
||||
editor.addMenuItem('pagebreak', {
|
||||
text: 'Page break',
|
||||
icon: 'pagebreak',
|
||||
cmd: 'mcePageBreak',
|
||||
context: 'insert'
|
||||
});
|
||||
|
||||
editor.on('ResolveName', function(e) {
|
||||
if (e.target.nodeName == 'IMG' && editor.dom.hasClass(e.target, pageBreakClass)) {
|
||||
e.name = 'pagebreak';
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('click', function(e) {
|
||||
e = e.target;
|
||||
|
||||
if (e.nodeName === 'IMG' && editor.dom.hasClass(e, pageBreakClass)) {
|
||||
editor.selection.select(e);
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('BeforeSetContent', function(e) {
|
||||
e.content = e.content.replace(pageBreakSeparatorRegExp, pageBreakPlaceHolderHtml);
|
||||
});
|
||||
|
||||
editor.on('PreInit', function() {
|
||||
editor.serializer.addNodeFilter('img', function(nodes) {
|
||||
var i = nodes.length, node, className;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
className = node.attr('class');
|
||||
if (className && className.indexOf('mce-pagebreak') !== -1) {
|
||||
// Replace parent block node if pagebreak_split_block is enabled
|
||||
var parentNode = node.parent;
|
||||
if (editor.schema.getBlockElements()[parentNode.name] && editor.settings.pagebreak_split_block) {
|
||||
parentNode.type = 3;
|
||||
parentNode.value = separatorHtml;
|
||||
parentNode.raw = true;
|
||||
node.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
node.type = 3;
|
||||
node.value = separatorHtml;
|
||||
node.raw = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/pagebreak/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("pagebreak",function(a){var b="mce-pagebreak",c=a.getParam("pagebreak_separator","<!-- pagebreak -->"),d=new RegExp(c.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(a){return"\\"+a}),"gi"),e='<img src="'+tinymce.Env.transparentSrc+'" class="'+b+'" data-mce-resize="false" data-mce-placeholder />';a.addCommand("mcePageBreak",function(){a.settings.pagebreak_split_block?a.insertContent("<p>"+e+"</p>"):a.insertContent(e)}),a.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),a.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"}),a.on("ResolveName",function(c){"IMG"==c.target.nodeName&&a.dom.hasClass(c.target,b)&&(c.name="pagebreak")}),a.on("click",function(c){c=c.target,"IMG"===c.nodeName&&a.dom.hasClass(c,b)&&a.selection.select(c)}),a.on("BeforeSetContent",function(a){a.content=a.content.replace(d,e)}),a.on("PreInit",function(){a.serializer.addNodeFilter("img",function(b){for(var d,e,f=b.length;f--;)if(d=b[f],e=d.attr("class"),e&&-1!==e.indexOf("mce-pagebreak")){var g=d.parent;if(a.schema.getBlockElements()[g.name]&&a.settings.pagebreak_split_block){g.type=3,g.value=c,g.raw=!0,d.remove();continue}d.type=3,d.value=c,d.raw=!0}})})});
|
||||
1835
assets/dashboard/plugins/tinymce/plugins/paste/plugin.js
Normal file
1
assets/dashboard/plugins/tinymce/plugins/paste/plugin.min.js
vendored
Normal file
101
assets/dashboard/plugins/tinymce/plugins/preview/plugin.js
Normal file
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('preview', function(editor) {
|
||||
var settings = editor.settings, sandbox = !tinymce.Env.ie;
|
||||
|
||||
editor.addCommand('mcePreview', function() {
|
||||
editor.windowManager.open({
|
||||
title: 'Preview',
|
||||
width: parseInt(editor.getParam("plugin_preview_width", "650"), 10),
|
||||
height: parseInt(editor.getParam("plugin_preview_height", "500"), 10),
|
||||
html: '<iframe src="javascript:\'\'" frameborder="0"' + (sandbox ? ' sandbox="allow-scripts"' : '') + '></iframe>',
|
||||
buttons: {
|
||||
text: 'Close',
|
||||
onclick: function() {
|
||||
this.parent().parent().close();
|
||||
}
|
||||
},
|
||||
onPostRender: function() {
|
||||
var previewHtml, headHtml = '';
|
||||
|
||||
headHtml += '<base href="' + editor.documentBaseURI.getURI() + '">';
|
||||
|
||||
tinymce.each(editor.contentCSS, function(url) {
|
||||
headHtml += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '">';
|
||||
});
|
||||
|
||||
var bodyId = settings.body_id || 'tinymce';
|
||||
if (bodyId.indexOf('=') != -1) {
|
||||
bodyId = editor.getParam('body_id', '', 'hash');
|
||||
bodyId = bodyId[editor.id] || bodyId;
|
||||
}
|
||||
|
||||
var bodyClass = settings.body_class || '';
|
||||
if (bodyClass.indexOf('=') != -1) {
|
||||
bodyClass = editor.getParam('body_class', '', 'hash');
|
||||
bodyClass = bodyClass[editor.id] || '';
|
||||
}
|
||||
|
||||
var preventClicksOnLinksScript = (
|
||||
'<script>' +
|
||||
'document.addEventListener && document.addEventListener("click", function(e) {' +
|
||||
'for (var elm = e.target; elm; elm = elm.parentNode) {' +
|
||||
'if (elm.nodeName === "A") {' +
|
||||
'e.preventDefault();' +
|
||||
'}' +
|
||||
'}' +
|
||||
'}, false);' +
|
||||
'</script> '
|
||||
);
|
||||
|
||||
var dirAttr = editor.settings.directionality ? ' dir="' + editor.settings.directionality + '"' : '';
|
||||
|
||||
previewHtml = (
|
||||
'<!DOCTYPE html>' +
|
||||
'<html>' +
|
||||
'<head>' +
|
||||
headHtml +
|
||||
'</head>' +
|
||||
'<body id="' + bodyId + '" class="mce-content-body ' + bodyClass + '"' + dirAttr + '>' +
|
||||
editor.getContent() +
|
||||
preventClicksOnLinksScript +
|
||||
'</body>' +
|
||||
'</html>'
|
||||
);
|
||||
|
||||
if (!sandbox) {
|
||||
// IE 6-11 doesn't support data uris on iframes
|
||||
// so I guess they will have to be less secure since we can't sandbox on those
|
||||
// TODO: Use sandbox if future versions of IE supports iframes with data: uris.
|
||||
var doc = this.getEl('body').firstChild.contentWindow.document;
|
||||
doc.open();
|
||||
doc.write(previewHtml);
|
||||
doc.close();
|
||||
} else {
|
||||
this.getEl('body').firstChild.src = 'data:text/html;charset=utf-8,' + encodeURIComponent(previewHtml);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editor.addButton('preview', {
|
||||
title: 'Preview',
|
||||
cmd: 'mcePreview'
|
||||
});
|
||||
|
||||
editor.addMenuItem('preview', {
|
||||
text: 'Preview',
|
||||
cmd: 'mcePreview',
|
||||
context: 'view'
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/preview/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("preview",function(a){var b=a.settings,c=!tinymce.Env.ie;a.addCommand("mcePreview",function(){a.windowManager.open({title:"Preview",width:parseInt(a.getParam("plugin_preview_width","650"),10),height:parseInt(a.getParam("plugin_preview_height","500"),10),html:'<iframe src="javascript:\'\'" frameborder="0"'+(c?' sandbox="allow-scripts"':"")+"></iframe>",buttons:{text:"Close",onclick:function(){this.parent().parent().close()}},onPostRender:function(){var d,e="";e+='<base href="'+a.documentBaseURI.getURI()+'">',tinymce.each(a.contentCSS,function(b){e+='<link type="text/css" rel="stylesheet" href="'+a.documentBaseURI.toAbsolute(b)+'">'});var f=b.body_id||"tinymce";-1!=f.indexOf("=")&&(f=a.getParam("body_id","","hash"),f=f[a.id]||f);var g=b.body_class||"";-1!=g.indexOf("=")&&(g=a.getParam("body_class","","hash"),g=g[a.id]||"");var h='<script>document.addEventListener && document.addEventListener("click", function(e) {for (var elm = e.target; elm; elm = elm.parentNode) {if (elm.nodeName === "A") {e.preventDefault();}}}, false);</script> ',i=a.settings.directionality?' dir="'+a.settings.directionality+'"':"";if(d="<!DOCTYPE html><html><head>"+e+'</head><body id="'+f+'" class="mce-content-body '+g+'"'+i+">"+a.getContent()+h+"</body></html>",c)this.getEl("body").firstChild.src="data:text/html;charset=utf-8,"+encodeURIComponent(d);else{var j=this.getEl("body").firstChild.contentWindow.document;j.open(),j.write(d),j.close()}}})}),a.addButton("preview",{title:"Preview",cmd:"mcePreview"}),a.addMenuItem("preview",{text:"Preview",cmd:"mcePreview",context:"view"})});
|
||||
32
assets/dashboard/plugins/tinymce/plugins/print/plugin.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('print', function(editor) {
|
||||
editor.addCommand('mcePrint', function() {
|
||||
editor.getWin().print();
|
||||
});
|
||||
|
||||
editor.addButton('print', {
|
||||
title: 'Print',
|
||||
cmd: 'mcePrint'
|
||||
});
|
||||
|
||||
editor.addShortcut('Meta+P', '', 'mcePrint');
|
||||
|
||||
editor.addMenuItem('print', {
|
||||
text: 'Print',
|
||||
cmd: 'mcePrint',
|
||||
icon: 'print',
|
||||
shortcut: 'Meta+P',
|
||||
context: 'file'
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/print/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("print",function(a){a.addCommand("mcePrint",function(){a.getWin().print()}),a.addButton("print",{title:"Print",cmd:"mcePrint"}),a.addShortcut("Meta+P","","mcePrint"),a.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Meta+P",context:"file"})});
|
||||
98
assets/dashboard/plugins/tinymce/plugins/save/plugin.js
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('save', function(editor) {
|
||||
function save() {
|
||||
var formObj;
|
||||
|
||||
formObj = tinymce.DOM.getParent(editor.id, 'form');
|
||||
|
||||
if (editor.getParam("save_enablewhendirty", true) && !editor.isDirty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
tinymce.triggerSave();
|
||||
|
||||
// Use callback instead
|
||||
if (editor.getParam("save_onsavecallback")) {
|
||||
editor.execCallback('save_onsavecallback', editor);
|
||||
editor.nodeChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
if (formObj) {
|
||||
editor.setDirty(false);
|
||||
|
||||
if (!formObj.onsubmit || formObj.onsubmit()) {
|
||||
if (typeof formObj.submit == "function") {
|
||||
formObj.submit();
|
||||
} else {
|
||||
displayErrorMessage(editor.translate("Error: Form submit field collision."));
|
||||
}
|
||||
}
|
||||
|
||||
editor.nodeChanged();
|
||||
} else {
|
||||
displayErrorMessage(editor.translate("Error: No form element found."));
|
||||
}
|
||||
}
|
||||
|
||||
function displayErrorMessage(message) {
|
||||
editor.notificationManager.open({
|
||||
text: message,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
var h = tinymce.trim(editor.startContent);
|
||||
|
||||
// Use callback instead
|
||||
if (editor.getParam("save_oncancelcallback")) {
|
||||
editor.execCallback('save_oncancelcallback', editor);
|
||||
return;
|
||||
}
|
||||
|
||||
editor.setContent(h);
|
||||
editor.undoManager.clear();
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
function stateToggle() {
|
||||
var self = this;
|
||||
|
||||
editor.on('nodeChange dirty', function() {
|
||||
self.disabled(editor.getParam("save_enablewhendirty", true) && !editor.isDirty());
|
||||
});
|
||||
}
|
||||
|
||||
editor.addCommand('mceSave', save);
|
||||
editor.addCommand('mceCancel', cancel);
|
||||
|
||||
editor.addButton('save', {
|
||||
icon: 'save',
|
||||
text: 'Save',
|
||||
cmd: 'mceSave',
|
||||
disabled: true,
|
||||
onPostRender: stateToggle
|
||||
});
|
||||
|
||||
editor.addButton('cancel', {
|
||||
text: 'Cancel',
|
||||
icon: false,
|
||||
cmd: 'mceCancel',
|
||||
disabled: true,
|
||||
onPostRender: stateToggle
|
||||
});
|
||||
|
||||
editor.addShortcut('Meta+S', '', 'mceSave');
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/save/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("save",function(a){function b(){var b;return b=tinymce.DOM.getParent(a.id,"form"),!a.getParam("save_enablewhendirty",!0)||a.isDirty()?(tinymce.triggerSave(),a.getParam("save_onsavecallback")?(a.execCallback("save_onsavecallback",a),void a.nodeChanged()):void(b?(a.setDirty(!1),b.onsubmit&&!b.onsubmit()||("function"==typeof b.submit?b.submit():c(a.translate("Error: Form submit field collision."))),a.nodeChanged()):c(a.translate("Error: No form element found.")))):void 0}function c(b){a.notificationManager.open({text:b,type:"error"})}function d(){var b=tinymce.trim(a.startContent);return a.getParam("save_oncancelcallback")?void a.execCallback("save_oncancelcallback",a):(a.setContent(b),a.undoManager.clear(),void a.nodeChanged())}function e(){var b=this;a.on("nodeChange dirty",function(){b.disabled(a.getParam("save_enablewhendirty",!0)&&!a.isDirty())})}a.addCommand("mceSave",b),a.addCommand("mceCancel",d),a.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:e}),a.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:e}),a.addShortcut("Meta+S","","mceSave")});
|
||||
609
assets/dashboard/plugins/tinymce/plugins/searchreplace/plugin.js
Normal file
@@ -0,0 +1,609 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*jshint smarttabs:true, undef:true, unused:true, latedef:true, curly:true, bitwise:true */
|
||||
/*eslint no-labels:0, no-constant-condition: 0 */
|
||||
/*global tinymce:true */
|
||||
|
||||
(function() {
|
||||
function isContentEditableFalse(node) {
|
||||
return node && node.nodeType == 1 && node.contentEditable === "false";
|
||||
}
|
||||
|
||||
// Based on work developed by: James Padolsey http://james.padolsey.com
|
||||
// released under UNLICENSE that is compatible with LGPL
|
||||
// TODO: Handle contentEditable edgecase:
|
||||
// <p>text<span contentEditable="false">text<span contentEditable="true">text</span>text</span>text</p>
|
||||
function findAndReplaceDOMText(regex, node, replacementNode, captureGroup, schema) {
|
||||
var m, matches = [], text, count = 0, doc;
|
||||
var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap;
|
||||
|
||||
doc = node.ownerDocument;
|
||||
blockElementsMap = schema.getBlockElements(); // H1-H6, P, TD etc
|
||||
hiddenTextElementsMap = schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT
|
||||
shortEndedElementsMap = schema.getShortEndedElements(); // BR, IMG, INPUT
|
||||
|
||||
function getMatchIndexes(m, captureGroup) {
|
||||
captureGroup = captureGroup || 0;
|
||||
|
||||
if (!m[0]) {
|
||||
throw 'findAndReplaceDOMText cannot handle zero-length matches';
|
||||
}
|
||||
|
||||
var index = m.index;
|
||||
|
||||
if (captureGroup > 0) {
|
||||
var cg = m[captureGroup];
|
||||
|
||||
if (!cg) {
|
||||
throw 'Invalid capture group';
|
||||
}
|
||||
|
||||
index += m[0].indexOf(cg);
|
||||
m[0] = cg;
|
||||
}
|
||||
|
||||
return [index, index + m[0].length, [m[0]]];
|
||||
}
|
||||
|
||||
function getText(node) {
|
||||
var txt;
|
||||
|
||||
if (node.nodeType === 3) {
|
||||
return node.data;
|
||||
}
|
||||
|
||||
if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) {
|
||||
return '';
|
||||
}
|
||||
|
||||
txt = '';
|
||||
|
||||
if (isContentEditableFalse(node)) {
|
||||
return '\n';
|
||||
}
|
||||
|
||||
if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) {
|
||||
txt += '\n';
|
||||
}
|
||||
|
||||
if ((node = node.firstChild)) {
|
||||
do {
|
||||
txt += getText(node);
|
||||
} while ((node = node.nextSibling));
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
function stepThroughMatches(node, matches, replaceFn) {
|
||||
var startNode, endNode, startNodeIndex,
|
||||
endNodeIndex, innerNodes = [], atIndex = 0, curNode = node,
|
||||
matchLocation = matches.shift(), matchIndex = 0;
|
||||
|
||||
out: while (true) {
|
||||
if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName] || isContentEditableFalse(curNode)) {
|
||||
atIndex++;
|
||||
}
|
||||
|
||||
if (curNode.nodeType === 3) {
|
||||
if (!endNode && curNode.length + atIndex >= matchLocation[1]) {
|
||||
// We've found the ending
|
||||
endNode = curNode;
|
||||
endNodeIndex = matchLocation[1] - atIndex;
|
||||
} else if (startNode) {
|
||||
// Intersecting node
|
||||
innerNodes.push(curNode);
|
||||
}
|
||||
|
||||
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
|
||||
// We've found the match start
|
||||
startNode = curNode;
|
||||
startNodeIndex = matchLocation[0] - atIndex;
|
||||
}
|
||||
|
||||
atIndex += curNode.length;
|
||||
}
|
||||
|
||||
if (startNode && endNode) {
|
||||
curNode = replaceFn({
|
||||
startNode: startNode,
|
||||
startNodeIndex: startNodeIndex,
|
||||
endNode: endNode,
|
||||
endNodeIndex: endNodeIndex,
|
||||
innerNodes: innerNodes,
|
||||
match: matchLocation[2],
|
||||
matchIndex: matchIndex
|
||||
});
|
||||
|
||||
// replaceFn has to return the node that replaced the endNode
|
||||
// and then we step back so we can continue from the end of the
|
||||
// match:
|
||||
atIndex -= (endNode.length - endNodeIndex);
|
||||
startNode = null;
|
||||
endNode = null;
|
||||
innerNodes = [];
|
||||
matchLocation = matches.shift();
|
||||
matchIndex++;
|
||||
|
||||
if (!matchLocation) {
|
||||
break; // no more matches
|
||||
}
|
||||
} else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) {
|
||||
if (!isContentEditableFalse(curNode)) {
|
||||
// Move down
|
||||
curNode = curNode.firstChild;
|
||||
continue;
|
||||
}
|
||||
} else if (curNode.nextSibling) {
|
||||
// Move forward:
|
||||
curNode = curNode.nextSibling;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Move forward or up:
|
||||
while (true) {
|
||||
if (curNode.nextSibling) {
|
||||
curNode = curNode.nextSibling;
|
||||
break;
|
||||
} else if (curNode.parentNode !== node) {
|
||||
curNode = curNode.parentNode;
|
||||
} else {
|
||||
break out;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the actual replaceFn which splits up text nodes
|
||||
* and inserts the replacement element.
|
||||
*/
|
||||
function genReplacer(nodeName) {
|
||||
var makeReplacementNode;
|
||||
|
||||
if (typeof nodeName != 'function') {
|
||||
var stencilNode = nodeName.nodeType ? nodeName : doc.createElement(nodeName);
|
||||
|
||||
makeReplacementNode = function(fill, matchIndex) {
|
||||
var clone = stencilNode.cloneNode(false);
|
||||
|
||||
clone.setAttribute('data-mce-index', matchIndex);
|
||||
|
||||
if (fill) {
|
||||
clone.appendChild(doc.createTextNode(fill));
|
||||
}
|
||||
|
||||
return clone;
|
||||
};
|
||||
} else {
|
||||
makeReplacementNode = nodeName;
|
||||
}
|
||||
|
||||
return function(range) {
|
||||
var before, after, parentNode, startNode = range.startNode,
|
||||
endNode = range.endNode, matchIndex = range.matchIndex;
|
||||
|
||||
if (startNode === endNode) {
|
||||
var node = startNode;
|
||||
|
||||
parentNode = node.parentNode;
|
||||
if (range.startNodeIndex > 0) {
|
||||
// Add `before` text node (before the match)
|
||||
before = doc.createTextNode(node.data.substring(0, range.startNodeIndex));
|
||||
parentNode.insertBefore(before, node);
|
||||
}
|
||||
|
||||
// Create the replacement node:
|
||||
var el = makeReplacementNode(range.match[0], matchIndex);
|
||||
parentNode.insertBefore(el, node);
|
||||
if (range.endNodeIndex < node.length) {
|
||||
// Add `after` text node (after the match)
|
||||
after = doc.createTextNode(node.data.substring(range.endNodeIndex));
|
||||
parentNode.insertBefore(after, node);
|
||||
}
|
||||
|
||||
node.parentNode.removeChild(node);
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
// Replace startNode -> [innerNodes...] -> endNode (in that order)
|
||||
before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex));
|
||||
after = doc.createTextNode(endNode.data.substring(range.endNodeIndex));
|
||||
var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex);
|
||||
var innerEls = [];
|
||||
|
||||
for (var i = 0, l = range.innerNodes.length; i < l; ++i) {
|
||||
var innerNode = range.innerNodes[i];
|
||||
var innerEl = makeReplacementNode(innerNode.data, matchIndex);
|
||||
innerNode.parentNode.replaceChild(innerEl, innerNode);
|
||||
innerEls.push(innerEl);
|
||||
}
|
||||
|
||||
var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex);
|
||||
|
||||
parentNode = startNode.parentNode;
|
||||
parentNode.insertBefore(before, startNode);
|
||||
parentNode.insertBefore(elA, startNode);
|
||||
parentNode.removeChild(startNode);
|
||||
|
||||
parentNode = endNode.parentNode;
|
||||
parentNode.insertBefore(elB, endNode);
|
||||
parentNode.insertBefore(after, endNode);
|
||||
parentNode.removeChild(endNode);
|
||||
|
||||
return elB;
|
||||
};
|
||||
}
|
||||
|
||||
text = getText(node);
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (regex.global) {
|
||||
while ((m = regex.exec(text))) {
|
||||
matches.push(getMatchIndexes(m, captureGroup));
|
||||
}
|
||||
} else {
|
||||
m = text.match(regex);
|
||||
matches.push(getMatchIndexes(m, captureGroup));
|
||||
}
|
||||
|
||||
if (matches.length) {
|
||||
count = matches.length;
|
||||
stepThroughMatches(node, matches, genReplacer(replacementNode));
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
function Plugin(editor) {
|
||||
var self = this, currentIndex = -1;
|
||||
|
||||
function showDialog() {
|
||||
var last = {}, selectedText;
|
||||
|
||||
selectedText = tinymce.trim(editor.selection.getContent({format: 'text'}));
|
||||
|
||||
function updateButtonStates() {
|
||||
win.statusbar.find('#next').disabled(!findSpansByIndex(currentIndex + 1).length);
|
||||
win.statusbar.find('#prev').disabled(!findSpansByIndex(currentIndex - 1).length);
|
||||
}
|
||||
|
||||
function notFoundAlert() {
|
||||
editor.windowManager.alert('Could not find the specified string.', function() {
|
||||
win.find('#find')[0].focus();
|
||||
});
|
||||
}
|
||||
|
||||
var win = editor.windowManager.open({
|
||||
layout: "flex",
|
||||
pack: "center",
|
||||
align: "center",
|
||||
onClose: function() {
|
||||
editor.focus();
|
||||
self.done();
|
||||
},
|
||||
onSubmit: function(e) {
|
||||
var count, caseState, text, wholeWord;
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
caseState = win.find('#case').checked();
|
||||
wholeWord = win.find('#words').checked();
|
||||
|
||||
text = win.find('#find').value();
|
||||
if (!text.length) {
|
||||
self.done(false);
|
||||
win.statusbar.items().slice(1).disabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (last.text == text && last.caseState == caseState && last.wholeWord == wholeWord) {
|
||||
if (findSpansByIndex(currentIndex + 1).length === 0) {
|
||||
notFoundAlert();
|
||||
return;
|
||||
}
|
||||
|
||||
self.next();
|
||||
updateButtonStates();
|
||||
return;
|
||||
}
|
||||
|
||||
count = self.find(text, caseState, wholeWord);
|
||||
if (!count) {
|
||||
notFoundAlert();
|
||||
}
|
||||
|
||||
win.statusbar.items().slice(1).disabled(count === 0);
|
||||
updateButtonStates();
|
||||
|
||||
last = {
|
||||
text: text,
|
||||
caseState: caseState,
|
||||
wholeWord: wholeWord
|
||||
};
|
||||
},
|
||||
buttons: [
|
||||
{text: "Find", subtype: 'primary', onclick: function() {
|
||||
win.submit();
|
||||
}},
|
||||
{text: "Replace", disabled: true, onclick: function() {
|
||||
if (!self.replace(win.find('#replace').value())) {
|
||||
win.statusbar.items().slice(1).disabled(true);
|
||||
currentIndex = -1;
|
||||
last = {};
|
||||
}
|
||||
}},
|
||||
{text: "Replace all", disabled: true, onclick: function() {
|
||||
self.replace(win.find('#replace').value(), true, true);
|
||||
win.statusbar.items().slice(1).disabled(true);
|
||||
last = {};
|
||||
}},
|
||||
{type: "spacer", flex: 1},
|
||||
{text: "Prev", name: 'prev', disabled: true, onclick: function() {
|
||||
self.prev();
|
||||
updateButtonStates();
|
||||
}},
|
||||
{text: "Next", name: 'next', disabled: true, onclick: function() {
|
||||
self.next();
|
||||
updateButtonStates();
|
||||
}}
|
||||
],
|
||||
title: "Find and replace",
|
||||
items: {
|
||||
type: "form",
|
||||
padding: 20,
|
||||
labelGap: 30,
|
||||
spacing: 10,
|
||||
items: [
|
||||
{type: 'textbox', name: 'find', size: 40, label: 'Find', value: selectedText},
|
||||
{type: 'textbox', name: 'replace', size: 40, label: 'Replace with'},
|
||||
{type: 'checkbox', name: 'case', text: 'Match case', label: ' '},
|
||||
{type: 'checkbox', name: 'words', text: 'Whole words', label: ' '}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
self.init = function(ed) {
|
||||
ed.addMenuItem('searchreplace', {
|
||||
text: 'Find and replace',
|
||||
shortcut: 'Meta+F',
|
||||
onclick: showDialog,
|
||||
separator: 'before',
|
||||
context: 'edit'
|
||||
});
|
||||
|
||||
ed.addButton('searchreplace', {
|
||||
tooltip: 'Find and replace',
|
||||
shortcut: 'Meta+F',
|
||||
onclick: showDialog
|
||||
});
|
||||
|
||||
ed.addCommand("SearchReplace", showDialog);
|
||||
ed.shortcuts.add('Meta+F', '', showDialog);
|
||||
};
|
||||
|
||||
function getElmIndex(elm) {
|
||||
var value = elm.getAttribute('data-mce-index');
|
||||
|
||||
if (typeof value == "number") {
|
||||
return "" + value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function markAllMatches(regex) {
|
||||
var node, marker;
|
||||
|
||||
marker = editor.dom.create('span', {
|
||||
"data-mce-bogus": 1
|
||||
});
|
||||
|
||||
marker.className = 'mce-match-marker'; // IE 7 adds class="mce-match-marker" and class=mce-match-marker
|
||||
node = editor.getBody();
|
||||
|
||||
self.done(false);
|
||||
|
||||
return findAndReplaceDOMText(regex, node, marker, false, editor.schema);
|
||||
}
|
||||
|
||||
function unwrap(node) {
|
||||
var parentNode = node.parentNode;
|
||||
|
||||
if (node.firstChild) {
|
||||
parentNode.insertBefore(node.firstChild, node);
|
||||
}
|
||||
|
||||
node.parentNode.removeChild(node);
|
||||
}
|
||||
|
||||
function findSpansByIndex(index) {
|
||||
var nodes, spans = [];
|
||||
|
||||
nodes = tinymce.toArray(editor.getBody().getElementsByTagName('span'));
|
||||
if (nodes.length) {
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var nodeIndex = getElmIndex(nodes[i]);
|
||||
|
||||
if (nodeIndex === null || !nodeIndex.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nodeIndex === index.toString()) {
|
||||
spans.push(nodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spans;
|
||||
}
|
||||
|
||||
function moveSelection(forward) {
|
||||
var testIndex = currentIndex, dom = editor.dom;
|
||||
|
||||
forward = forward !== false;
|
||||
|
||||
if (forward) {
|
||||
testIndex++;
|
||||
} else {
|
||||
testIndex--;
|
||||
}
|
||||
|
||||
dom.removeClass(findSpansByIndex(currentIndex), 'mce-match-marker-selected');
|
||||
|
||||
var spans = findSpansByIndex(testIndex);
|
||||
if (spans.length) {
|
||||
dom.addClass(findSpansByIndex(testIndex), 'mce-match-marker-selected');
|
||||
editor.selection.scrollIntoView(spans[0]);
|
||||
return testIndex;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
function removeNode(node) {
|
||||
var dom = editor.dom, parent = node.parentNode;
|
||||
|
||||
dom.remove(node);
|
||||
|
||||
if (dom.isEmpty(parent)) {
|
||||
dom.remove(parent);
|
||||
}
|
||||
}
|
||||
|
||||
self.find = function(text, matchCase, wholeWord) {
|
||||
text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
||||
text = wholeWord ? '\\b' + text + '\\b' : text;
|
||||
|
||||
var count = markAllMatches(new RegExp(text, matchCase ? 'g' : 'gi'));
|
||||
|
||||
if (count) {
|
||||
currentIndex = -1;
|
||||
currentIndex = moveSelection(true);
|
||||
}
|
||||
|
||||
return count;
|
||||
};
|
||||
|
||||
self.next = function() {
|
||||
var index = moveSelection(true);
|
||||
|
||||
if (index !== -1) {
|
||||
currentIndex = index;
|
||||
}
|
||||
};
|
||||
|
||||
self.prev = function() {
|
||||
var index = moveSelection(false);
|
||||
|
||||
if (index !== -1) {
|
||||
currentIndex = index;
|
||||
}
|
||||
};
|
||||
|
||||
function isMatchSpan(node) {
|
||||
var matchIndex = getElmIndex(node);
|
||||
|
||||
return matchIndex !== null && matchIndex.length > 0;
|
||||
}
|
||||
|
||||
self.replace = function(text, forward, all) {
|
||||
var i, nodes, node, matchIndex, currentMatchIndex, nextIndex = currentIndex, hasMore;
|
||||
|
||||
forward = forward !== false;
|
||||
|
||||
node = editor.getBody();
|
||||
nodes = tinymce.grep(tinymce.toArray(node.getElementsByTagName('span')), isMatchSpan);
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
var nodeIndex = getElmIndex(nodes[i]);
|
||||
|
||||
matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
|
||||
if (all || matchIndex === currentIndex) {
|
||||
if (text.length) {
|
||||
nodes[i].firstChild.nodeValue = text;
|
||||
unwrap(nodes[i]);
|
||||
} else {
|
||||
removeNode(nodes[i]);
|
||||
}
|
||||
|
||||
while (nodes[++i]) {
|
||||
matchIndex = parseInt(getElmIndex(nodes[i]), 10);
|
||||
|
||||
if (matchIndex === currentMatchIndex) {
|
||||
removeNode(nodes[i]);
|
||||
} else {
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (forward) {
|
||||
nextIndex--;
|
||||
}
|
||||
} else if (currentMatchIndex > currentIndex) {
|
||||
nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1);
|
||||
}
|
||||
}
|
||||
|
||||
editor.undoManager.add();
|
||||
currentIndex = nextIndex;
|
||||
|
||||
if (forward) {
|
||||
hasMore = findSpansByIndex(nextIndex + 1).length > 0;
|
||||
self.next();
|
||||
} else {
|
||||
hasMore = findSpansByIndex(nextIndex - 1).length > 0;
|
||||
self.prev();
|
||||
}
|
||||
|
||||
return !all && hasMore;
|
||||
};
|
||||
|
||||
self.done = function(keepEditorSelection) {
|
||||
var i, nodes, startContainer, endContainer;
|
||||
|
||||
nodes = tinymce.toArray(editor.getBody().getElementsByTagName('span'));
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
var nodeIndex = getElmIndex(nodes[i]);
|
||||
|
||||
if (nodeIndex !== null && nodeIndex.length) {
|
||||
if (nodeIndex === currentIndex.toString()) {
|
||||
if (!startContainer) {
|
||||
startContainer = nodes[i].firstChild;
|
||||
}
|
||||
|
||||
endContainer = nodes[i].firstChild;
|
||||
}
|
||||
|
||||
unwrap(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (startContainer && endContainer) {
|
||||
var rng = editor.dom.createRng();
|
||||
rng.setStart(startContainer, 0);
|
||||
rng.setEnd(endContainer, endContainer.data.length);
|
||||
|
||||
if (keepEditorSelection !== false) {
|
||||
editor.selection.setRng(rng);
|
||||
}
|
||||
|
||||
return rng;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.PluginManager.add('searchreplace', Plugin);
|
||||
})();
|
||||
1
assets/dashboard/plugins/tinymce/plugins/searchreplace/plugin.min.js
vendored
Normal file
1019
assets/dashboard/plugins/tinymce/plugins/spellchecker/plugin.js
Normal file
1
assets/dashboard/plugins/tinymce/plugins/spellchecker/plugin.min.js
vendored
Normal file
120
assets/dashboard/plugins/tinymce/plugins/tabfocus/plugin.js
Normal file
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('tabfocus', function(editor) {
|
||||
var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
|
||||
|
||||
function tabCancel(e) {
|
||||
if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function tabHandler(e) {
|
||||
var x, el, v, i;
|
||||
|
||||
if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
|
||||
function find(direction) {
|
||||
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
|
||||
|
||||
function canSelectRecursive(e) {
|
||||
return e.nodeName === "BODY" || (e.type != 'hidden' &&
|
||||
e.style.display != "none" &&
|
||||
e.style.visibility != "hidden" && canSelectRecursive(e.parentNode));
|
||||
}
|
||||
|
||||
function canSelect(el) {
|
||||
return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && tinymce.get(e.id) && el.tabIndex != -1 && canSelectRecursive(el);
|
||||
}
|
||||
|
||||
each(el, function(e, i) {
|
||||
if (e.id == editor.id) {
|
||||
x = i;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (direction > 0) {
|
||||
for (i = x + 1; i < el.length; i++) {
|
||||
if (canSelect(el[i])) {
|
||||
return el[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = x - 1; i >= 0; i--) {
|
||||
if (canSelect(el[i])) {
|
||||
return el[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
|
||||
|
||||
if (v.length == 1) {
|
||||
v[1] = v[0];
|
||||
v[0] = ':prev';
|
||||
}
|
||||
|
||||
// Find element to focus
|
||||
if (e.shiftKey) {
|
||||
if (v[0] == ':prev') {
|
||||
el = find(-1);
|
||||
} else {
|
||||
el = DOM.get(v[0]);
|
||||
}
|
||||
} else {
|
||||
if (v[1] == ':next') {
|
||||
el = find(1);
|
||||
} else {
|
||||
el = DOM.get(v[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (el) {
|
||||
var focusEditor = tinymce.get(el.id || el.name);
|
||||
|
||||
if (el.id && focusEditor) {
|
||||
focusEditor.focus();
|
||||
} else {
|
||||
tinymce.util.Delay.setTimeout(function() {
|
||||
if (!tinymce.Env.webkit) {
|
||||
window.focus();
|
||||
}
|
||||
|
||||
el.focus();
|
||||
}, 10);
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
editor.on('init', function() {
|
||||
if (editor.inline) {
|
||||
// Remove default tabIndex in inline mode
|
||||
tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null);
|
||||
}
|
||||
|
||||
editor.on('keyup', tabCancel);
|
||||
|
||||
if (tinymce.Env.gecko) {
|
||||
editor.on('keypress keydown', tabHandler);
|
||||
} else {
|
||||
editor.on('keydown', tabHandler);
|
||||
}
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/tabfocus/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(c){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function i(a){return/INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&tinymce.get(b.id)&&-1!=a.tabIndex&&f(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),c>0){for(j=g+1;j<h.length;j++)if(i(h[j]))return h[j]}else for(j=g-1;j>=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey||b.isDefaultPrevented())&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():tinymce.util.Delay.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)})});
|
||||
4152
assets/dashboard/plugins/tinymce/plugins/table/plugin.js
Normal file
2
assets/dashboard/plugins/tinymce/plugins/table/plugin.min.js
vendored
Normal file
276
assets/dashboard/plugins/tinymce/plugins/template/plugin.js
Normal file
@@ -0,0 +1,276 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('template', function(editor) {
|
||||
var each = tinymce.each;
|
||||
|
||||
function createTemplateList(callback) {
|
||||
return function() {
|
||||
var templateList = editor.settings.templates;
|
||||
|
||||
if (typeof templateList == "function") {
|
||||
templateList(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof templateList == "string") {
|
||||
tinymce.util.XHR.send({
|
||||
url: templateList,
|
||||
success: function(text) {
|
||||
callback(tinymce.util.JSON.parse(text));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback(templateList);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function showDialog(templateList) {
|
||||
var win, values = [], templateHtml;
|
||||
|
||||
if (!templateList || templateList.length === 0) {
|
||||
var message = editor.translate('No templates defined.');
|
||||
editor.notificationManager.open({text: message, type: 'info'});
|
||||
return;
|
||||
}
|
||||
|
||||
tinymce.each(templateList, function(template) {
|
||||
values.push({
|
||||
selected: !values.length,
|
||||
text: template.title,
|
||||
value: {
|
||||
url: template.url,
|
||||
content: template.content,
|
||||
description: template.description
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onSelectTemplate(e) {
|
||||
var value = e.control.value();
|
||||
|
||||
function insertIframeHtml(html) {
|
||||
if (html.indexOf('<html>') == -1) {
|
||||
var contentCssLinks = '';
|
||||
|
||||
tinymce.each(editor.contentCSS, function(url) {
|
||||
contentCssLinks += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '">';
|
||||
});
|
||||
|
||||
var bodyClass = editor.settings.body_class || '';
|
||||
if (bodyClass.indexOf('=') != -1) {
|
||||
bodyClass = editor.getParam('body_class', '', 'hash');
|
||||
bodyClass = bodyClass[editor.id] || '';
|
||||
}
|
||||
|
||||
html = (
|
||||
'<!DOCTYPE html>' +
|
||||
'<html>' +
|
||||
'<head>' +
|
||||
contentCssLinks +
|
||||
'</head>' +
|
||||
'<body class="' + bodyClass + '">' +
|
||||
html +
|
||||
'</body>' +
|
||||
'</html>'
|
||||
);
|
||||
}
|
||||
|
||||
html = replaceTemplateValues(html, 'template_preview_replace_values');
|
||||
|
||||
var doc = win.find('iframe')[0].getEl().contentWindow.document;
|
||||
doc.open();
|
||||
doc.write(html);
|
||||
doc.close();
|
||||
}
|
||||
|
||||
if (value.url) {
|
||||
tinymce.util.XHR.send({
|
||||
url: value.url,
|
||||
success: function(html) {
|
||||
templateHtml = html;
|
||||
insertIframeHtml(templateHtml);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
templateHtml = value.content;
|
||||
insertIframeHtml(templateHtml);
|
||||
}
|
||||
|
||||
win.find('#description')[0].text(e.control.value().description);
|
||||
}
|
||||
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert template',
|
||||
layout: 'flex',
|
||||
direction: 'column',
|
||||
align: 'stretch',
|
||||
padding: 15,
|
||||
spacing: 10,
|
||||
|
||||
items: [
|
||||
{type: 'form', flex: 0, padding: 0, items: [
|
||||
{type: 'container', label: 'Templates', items: {
|
||||
type: 'listbox', label: 'Templates', name: 'template', values: values, onselect: onSelectTemplate
|
||||
}}
|
||||
]},
|
||||
{type: 'label', name: 'description', label: 'Description', text: '\u00a0'},
|
||||
{type: 'iframe', flex: 1, border: 1}
|
||||
],
|
||||
|
||||
onsubmit: function() {
|
||||
insertTemplate(false, templateHtml);
|
||||
},
|
||||
|
||||
width: editor.getParam('template_popup_width', 600),
|
||||
height: editor.getParam('template_popup_height', 500)
|
||||
});
|
||||
|
||||
win.find('listbox')[0].fire('select');
|
||||
}
|
||||
|
||||
function getDateTime(fmt, date) {
|
||||
var daysShort = "Sun Mon Tue Wed Thu Fri Sat Sun".split(' ');
|
||||
var daysLong = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(' ');
|
||||
var monthsShort = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(' ');
|
||||
var monthsLong = "January February March April May June July August September October November December".split(' ');
|
||||
|
||||
function addZeros(value, len) {
|
||||
value = "" + value;
|
||||
|
||||
if (value.length < len) {
|
||||
for (var i = 0; i < (len - value.length); i++) {
|
||||
value = "0" + value;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
date = date || new Date();
|
||||
|
||||
fmt = fmt.replace("%D", "%m/%d/%Y");
|
||||
fmt = fmt.replace("%r", "%I:%M:%S %p");
|
||||
fmt = fmt.replace("%Y", "" + date.getFullYear());
|
||||
fmt = fmt.replace("%y", "" + date.getYear());
|
||||
fmt = fmt.replace("%m", addZeros(date.getMonth() + 1, 2));
|
||||
fmt = fmt.replace("%d", addZeros(date.getDate(), 2));
|
||||
fmt = fmt.replace("%H", "" + addZeros(date.getHours(), 2));
|
||||
fmt = fmt.replace("%M", "" + addZeros(date.getMinutes(), 2));
|
||||
fmt = fmt.replace("%S", "" + addZeros(date.getSeconds(), 2));
|
||||
fmt = fmt.replace("%I", "" + ((date.getHours() + 11) % 12 + 1));
|
||||
fmt = fmt.replace("%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
|
||||
fmt = fmt.replace("%B", "" + editor.translate(monthsLong[date.getMonth()]));
|
||||
fmt = fmt.replace("%b", "" + editor.translate(monthsShort[date.getMonth()]));
|
||||
fmt = fmt.replace("%A", "" + editor.translate(daysLong[date.getDay()]));
|
||||
fmt = fmt.replace("%a", "" + editor.translate(daysShort[date.getDay()]));
|
||||
fmt = fmt.replace("%%", "%");
|
||||
|
||||
return fmt;
|
||||
}
|
||||
|
||||
function replaceVals(e) {
|
||||
var dom = editor.dom, vl = editor.getParam('template_replace_values');
|
||||
|
||||
each(dom.select('*', e), function(e) {
|
||||
each(vl, function(v, k) {
|
||||
if (dom.hasClass(e, k)) {
|
||||
if (typeof vl[k] == 'function') {
|
||||
vl[k](e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function replaceTemplateValues(html, templateValuesOptionName) {
|
||||
each(editor.getParam(templateValuesOptionName), function(v, k) {
|
||||
if (typeof v == 'function') {
|
||||
v = v(k);
|
||||
}
|
||||
|
||||
html = html.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v);
|
||||
});
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function insertTemplate(ui, html) {
|
||||
var el, n, dom = editor.dom, sel = editor.selection.getContent();
|
||||
|
||||
html = replaceTemplateValues(html, 'template_replace_values');
|
||||
el = dom.create('div', null, html);
|
||||
|
||||
// Find template element within div
|
||||
n = dom.select('.mceTmpl', el);
|
||||
if (n && n.length > 0) {
|
||||
el = dom.create('div', null);
|
||||
el.appendChild(n[0].cloneNode(true));
|
||||
}
|
||||
|
||||
function hasClass(n, c) {
|
||||
return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
|
||||
}
|
||||
|
||||
each(dom.select('*', el), function(n) {
|
||||
// Replace cdate
|
||||
if (hasClass(n, editor.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) {
|
||||
n.innerHTML = getDateTime(editor.getParam("template_cdate_format", editor.getLang("template.cdate_format")));
|
||||
}
|
||||
|
||||
// Replace mdate
|
||||
if (hasClass(n, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) {
|
||||
n.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format")));
|
||||
}
|
||||
|
||||
// Replace selection
|
||||
if (hasClass(n, editor.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) {
|
||||
n.innerHTML = sel;
|
||||
}
|
||||
});
|
||||
|
||||
replaceVals(el);
|
||||
|
||||
editor.execCommand('mceInsertContent', false, el.innerHTML);
|
||||
editor.addVisual();
|
||||
}
|
||||
|
||||
editor.addCommand('mceInsertTemplate', insertTemplate);
|
||||
|
||||
editor.addButton('template', {
|
||||
title: 'Insert template',
|
||||
onclick: createTemplateList(showDialog)
|
||||
});
|
||||
|
||||
editor.addMenuItem('template', {
|
||||
text: 'Insert template',
|
||||
onclick: createTemplateList(showDialog),
|
||||
context: 'insert'
|
||||
});
|
||||
|
||||
editor.on('PreProcess', function(o) {
|
||||
var dom = editor.dom;
|
||||
|
||||
each(dom.select('div', o.node), function(e) {
|
||||
if (dom.hasClass(e, 'mceTmpl')) {
|
||||
each(dom.select('*', e), function(e) {
|
||||
if (dom.hasClass(e, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) {
|
||||
e.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format")));
|
||||
}
|
||||
});
|
||||
|
||||
replaceVals(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
1
assets/dashboard/plugins/tinymce/plugins/template/plugin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("template",function(a){function b(b){return function(){var c=a.settings.templates;return"function"==typeof c?void c(b):void("string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):b(c))}}function c(b){function c(b){function c(b){if(-1==b.indexOf("<html>")){var c="";tinymce.each(a.contentCSS,function(b){c+='<link type="text/css" rel="stylesheet" href="'+a.documentBaseURI.toAbsolute(b)+'">'});var e=a.settings.body_class||"";-1!=e.indexOf("=")&&(e=a.getParam("body_class","","hash"),e=e[a.id]||""),b="<!DOCTYPE html><html><head>"+c+'</head><body class="'+e+'">'+b+"</body></html>"}b=f(b,"template_preview_replace_values");var g=d.find("iframe")[0].getEl().contentWindow.document;g.open(),g.write(b),g.close()}var g=b.control.value();g.url?tinymce.util.XHR.send({url:g.url,success:function(a){e=a,c(e)}}):(e=g.content,c(e)),d.find("#description")[0].text(b.control.value().description)}var d,e,h=[];if(!b||0===b.length){var i=a.translate("No templates defined.");return void a.notificationManager.open({text:i,type:"info"})}tinymce.each(b,function(a){h.push({selected:!h.length,text:a.title,value:{url:a.url,content:a.content,description:a.description}})}),d=a.windowManager.open({title:"Insert template",layout:"flex",direction:"column",align:"stretch",padding:15,spacing:10,items:[{type:"form",flex:0,padding:0,items:[{type:"container",label:"Templates",items:{type:"listbox",label:"Templates",name:"template",values:h,onselect:c}}]},{type:"label",name:"description",label:"Description",text:"\xa0"},{type:"iframe",flex:1,border:1}],onsubmit:function(){g(!1,e)},width:a.getParam("template_popup_width",600),height:a.getParam("template_popup_height",500)}),d.find("listbox")[0].fire("select")}function d(b,c){function d(a,b){if(a=""+a,a.length<b)for(var c=0;c<b-a.length;c++)a="0"+a;return a}var e="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),g="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),h="January February March April May June July August September October November December".split(" ");return c=c||new Date,b=b.replace("%D","%m/%d/%Y"),b=b.replace("%r","%I:%M:%S %p"),b=b.replace("%Y",""+c.getFullYear()),b=b.replace("%y",""+c.getYear()),b=b.replace("%m",d(c.getMonth()+1,2)),b=b.replace("%d",d(c.getDate(),2)),b=b.replace("%H",""+d(c.getHours(),2)),b=b.replace("%M",""+d(c.getMinutes(),2)),b=b.replace("%S",""+d(c.getSeconds(),2)),b=b.replace("%I",""+((c.getHours()+11)%12+1)),b=b.replace("%p",""+(c.getHours()<12?"AM":"PM")),b=b.replace("%B",""+a.translate(h[c.getMonth()])),b=b.replace("%b",""+a.translate(g[c.getMonth()])),b=b.replace("%A",""+a.translate(f[c.getDay()])),b=b.replace("%a",""+a.translate(e[c.getDay()])),b=b.replace("%%","%")}function e(b){var c=a.dom,d=a.getParam("template_replace_values");h(c.select("*",b),function(a){h(d,function(b,e){c.hasClass(a,e)&&"function"==typeof d[e]&&d[e](a)})})}function f(b,c){return h(a.getParam(c),function(a,c){"function"==typeof a&&(a=a(c)),b=b.replace(new RegExp("\\{\\$"+c+"\\}","g"),a)}),b}function g(b,c){function g(a,b){return new RegExp("\\b"+b+"\\b","g").test(a.className)}var i,j,k=a.dom,l=a.selection.getContent();c=f(c,"template_replace_values"),i=k.create("div",null,c),j=k.select(".mceTmpl",i),j&&j.length>0&&(i=k.create("div",null),i.appendChild(j[0].cloneNode(!0))),h(k.select("*",i),function(b){g(b,a.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_cdate_format",a.getLang("template.cdate_format")))),g(b,a.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_mdate_format",a.getLang("template.mdate_format")))),g(b,a.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))&&(b.innerHTML=l)}),e(i),a.execCommand("mceInsertContent",!1,i.innerHTML),a.addVisual()}var h=tinymce.each;a.addCommand("mceInsertTemplate",g),a.addButton("template",{title:"Insert template",onclick:b(c)}),a.addMenuItem("template",{text:"Insert template",onclick:b(c),context:"insert"}),a.on("PreProcess",function(b){var c=a.dom;h(c.select("div",b.node),function(b){c.hasClass(b,"mceTmpl")&&(h(c.select("*",b),function(b){c.hasClass(b,a.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(b.innerHTML=d(a.getParam("template_mdate_format",a.getLang("template.mdate_format"))))}),e(b))})})});
|
||||
297
assets/dashboard/plugins/tinymce/plugins/textcolor/plugin.js
Normal file
@@ -0,0 +1,297 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Released under LGPL License.
|
||||
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
/*eslint consistent-this:0 */
|
||||
|
||||
tinymce.PluginManager.add('textcolor', function(editor) {
|
||||
var cols, rows;
|
||||
|
||||
rows = {
|
||||
forecolor: editor.settings.forecolor_rows || editor.settings.textcolor_rows || 5,
|
||||
backcolor: editor.settings.backcolor_rows || editor.settings.textcolor_rows || 5
|
||||
};
|
||||
cols = {
|
||||
forecolor: editor.settings.forecolor_cols || editor.settings.textcolor_cols || 8,
|
||||
backcolor: editor.settings.backcolor_cols || editor.settings.textcolor_cols || 8
|
||||
};
|
||||
|
||||
function getCurrentColor(format) {
|
||||
var color;
|
||||
|
||||
editor.dom.getParents(editor.selection.getStart(), function(elm) {
|
||||
var value;
|
||||
|
||||
if ((value = elm.style[format == 'forecolor' ? 'color' : 'background-color'])) {
|
||||
color = value;
|
||||
}
|
||||
});
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
function mapColors(type) {
|
||||
var i, colors = [], colorMap;
|
||||
|
||||
colorMap = [
|
||||
"000000", "Black",
|
||||
"993300", "Burnt orange",
|
||||
"333300", "Dark olive",
|
||||
"003300", "Dark green",
|
||||
"003366", "Dark azure",
|
||||
"000080", "Navy Blue",
|
||||
"333399", "Indigo",
|
||||
"333333", "Very dark gray",
|
||||
"800000", "Maroon",
|
||||
"FF6600", "Orange",
|
||||
"808000", "Olive",
|
||||
"008000", "Green",
|
||||
"008080", "Teal",
|
||||
"0000FF", "Blue",
|
||||
"666699", "Grayish blue",
|
||||
"808080", "Gray",
|
||||
"FF0000", "Red",
|
||||
"FF9900", "Amber",
|
||||
"99CC00", "Yellow green",
|
||||
"339966", "Sea green",
|
||||
"33CCCC", "Turquoise",
|
||||
"3366FF", "Royal blue",
|
||||
"800080", "Purple",
|
||||
"999999", "Medium gray",
|
||||
"FF00FF", "Magenta",
|
||||
"FFCC00", "Gold",
|
||||
"FFFF00", "Yellow",
|
||||
"00FF00", "Lime",
|
||||
"00FFFF", "Aqua",
|
||||
"00CCFF", "Sky blue",
|
||||
"993366", "Red violet",
|
||||
"FFFFFF", "White",
|
||||
"FF99CC", "Pink",
|
||||
"FFCC99", "Peach",
|
||||
"FFFF99", "Light yellow",
|
||||
"CCFFCC", "Pale green",
|
||||
"CCFFFF", "Pale cyan",
|
||||
"99CCFF", "Light sky blue",
|
||||
"CC99FF", "Plum"
|
||||
];
|
||||
|
||||
colorMap = editor.settings.textcolor_map || colorMap;
|
||||
colorMap = editor.settings[type + '_map'] || colorMap;
|
||||
|
||||
for (i = 0; i < colorMap.length; i += 2) {
|
||||
colors.push({
|
||||
text: colorMap[i + 1],
|
||||
color: '#' + colorMap[i]
|
||||
});
|
||||
}
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
function renderColorPicker() {
|
||||
var ctrl = this, colors, color, html, last, x, y, i, id = ctrl._id, count = 0, type;
|
||||
|
||||
type = ctrl.settings.origin;
|
||||
|
||||
function getColorCellHtml(color, title) {
|
||||
var isNoColor = color == 'transparent';
|
||||
|
||||
return (
|
||||
'<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' +
|
||||
'<div id="' + id + '-' + (count++) + '"' +
|
||||
' data-mce-color="' + (color ? color : '') + '"' +
|
||||
' role="option"' +
|
||||
' tabIndex="-1"' +
|
||||
' style="' + (color ? 'background-color: ' + color : '') + '"' +
|
||||
' title="' + tinymce.translate(title) + '">' +
|
||||
(isNoColor ? '×' : '') +
|
||||
'</div>' +
|
||||
'</td>'
|
||||
);
|
||||
}
|
||||
|
||||
colors = mapColors(type);
|
||||
colors.push({
|
||||
text: tinymce.translate("No color"),
|
||||
color: "transparent"
|
||||
});
|
||||
|
||||
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
|
||||
last = colors.length - 1;
|
||||
|
||||
for (y = 0; y < rows[type]; y++) {
|
||||
html += '<tr>';
|
||||
|
||||
for (x = 0; x < cols[type]; x++) {
|
||||
i = y * cols[type] + x;
|
||||
|
||||
if (i > last) {
|
||||
html += '<td></td>';
|
||||
} else {
|
||||
color = colors[i];
|
||||
html += getColorCellHtml(color.color, color.text);
|
||||
}
|
||||
}
|
||||
|
||||
html += '</tr>';
|
||||
}
|
||||
|
||||
if (editor.settings.color_picker_callback) {
|
||||
html += (
|
||||
'<tr>' +
|
||||
'<td colspan="' + cols[type] + '" class="mce-custom-color-btn">' +
|
||||
'<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' +
|
||||
'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' +
|
||||
'<button type="button" role="presentation" tabindex="-1">' + tinymce.translate('Custom...') + '</button>' +
|
||||
'</div>' +
|
||||
'</td>' +
|
||||
'</tr>'
|
||||
);
|
||||
|
||||
html += '<tr>';
|
||||
|
||||
for (x = 0; x < cols[type]; x++) {
|
||||
html += getColorCellHtml('', 'Custom color');
|
||||
}
|
||||
|
||||
html += '</tr>';
|
||||
}
|
||||
|
||||
html += '</tbody></table>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function applyFormat(format, value) {
|
||||
editor.undoManager.transact(function() {
|
||||
editor.focus();
|
||||
editor.formatter.apply(format, {value: value});
|
||||
editor.nodeChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function removeFormat(format) {
|
||||
editor.undoManager.transact(function() {
|
||||
editor.focus();
|
||||
editor.formatter.remove(format, {value: null}, null, true);
|
||||
editor.nodeChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function onPanelClick(e) {
|
||||
var buttonCtrl = this.parent(), value, type;
|
||||
|
||||
type = buttonCtrl.settings.origin;
|
||||
|
||||
function selectColor(value) {
|
||||
buttonCtrl.hidePanel();
|
||||
buttonCtrl.color(value);
|
||||
applyFormat(buttonCtrl.settings.format, value);
|
||||
}
|
||||
|
||||
function resetColor() {
|
||||
buttonCtrl.hidePanel();
|
||||
buttonCtrl.resetColor();
|
||||
removeFormat(buttonCtrl.settings.format);
|
||||
}
|
||||
|
||||
function setDivColor(div, value) {
|
||||
div.style.background = value;
|
||||
div.setAttribute('data-mce-color', value);
|
||||
}
|
||||
|
||||
if (tinymce.DOM.getParent(e.target, '.mce-custom-color-btn')) {
|
||||
buttonCtrl.hidePanel();
|
||||
|
||||
editor.settings.color_picker_callback.call(editor, function(value) {
|
||||
var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
|
||||
var customColorCells, div, i;
|
||||
|
||||
customColorCells = tinymce.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function(elm) {
|
||||
return elm.firstChild;
|
||||
});
|
||||
|
||||
for (i = 0; i < customColorCells.length; i++) {
|
||||
div = customColorCells[i];
|
||||
if (!div.getAttribute('data-mce-color')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Shift colors to the right
|
||||
// TODO: Might need to be the left on RTL
|
||||
if (i == cols[type]) {
|
||||
for (i = 0; i < cols[type] - 1; i++) {
|
||||
setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
|
||||
}
|
||||
}
|
||||
|
||||
setDivColor(div, value);
|
||||
selectColor(value);
|
||||
}, getCurrentColor(buttonCtrl.settings.format));
|
||||
}
|
||||
|
||||
value = e.target.getAttribute('data-mce-color');
|
||||
if (value) {
|
||||
if (this.lastId) {
|
||||
document.getElementById(this.lastId).setAttribute('aria-selected', false);
|
||||
}
|
||||
|
||||
e.target.setAttribute('aria-selected', true);
|
||||
this.lastId = e.target.id;
|
||||
|
||||
if (value == 'transparent') {
|
||||
resetColor();
|
||||
} else {
|
||||
selectColor(value);
|
||||
}
|
||||
} else if (value !== null) {
|
||||
buttonCtrl.hidePanel();
|
||||
}
|
||||
}
|
||||
|
||||
function onButtonClick() {
|
||||
var self = this;
|
||||
|
||||
if (self._color) {
|
||||
applyFormat(self.settings.format, self._color);
|
||||
} else {
|
||||
removeFormat(self.settings.format);
|
||||
}
|
||||
}
|
||||
|
||||
editor.addButton('forecolor', {
|
||||
type: 'colorbutton',
|
||||
tooltip: 'Text color',
|
||||
format: 'forecolor',
|
||||
panel: {
|
||||
origin: 'forecolor',
|
||||
role: 'application',
|
||||
ariaRemember: true,
|
||||
html: renderColorPicker,
|
||||
onclick: onPanelClick
|
||||
},
|
||||
onclick: onButtonClick
|
||||
});
|
||||
|
||||
editor.addButton('backcolor', {
|
||||
type: 'colorbutton',
|
||||
tooltip: 'Background color',
|
||||
format: 'hilitecolor',
|
||||
panel: {
|
||||
origin: 'backcolor',
|
||||
role: 'application',
|
||||
ariaRemember: true,
|
||||
html: renderColorPicker,
|
||||
onclick: onPanelClick
|
||||
},
|
||||
onclick: onButtonClick
|
||||
});
|
||||
});
|
||||