Refactoring

This commit is contained in:
gamonoid
2017-09-03 20:39:22 +02:00
parent af40881847
commit a7274d3cfd
5075 changed files with 238202 additions and 16291 deletions

View File

@@ -0,0 +1,36 @@
{
"name": "simplemde",
"version": "1.11.2",
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"authors": [
"Wes Cossick <https://wescossick.com>"
],
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor.",
"main": [
"src/js/simplemde.js",
"src/css/simplemde.css"
],
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"wysiwyg"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components"
],
"_release": "1.11.2",
"_resolution": {
"type": "version",
"tag": "1.11.2",
"commit": "6abda7ab68cc20f4aca870eb243747951b90ab04"
},
"_source": "https://github.com/NextStepWebs/simplemde-markdown-editor.git",
"_target": "^1.11.2",
"_originalSource": "simplemde",
"_direct": true
}

View File

@@ -0,0 +1,10 @@
### Overview
First of all, thanks for your interest in helping make SimpleMDE even better. Contributions help resolve rare bugs, accomplish neat new features, polish the code, and improve the documentation.
### Guidelines for contributing
- The *most important* guideline for contributing is to compare against the `development` branch when creating a pull request. This allows time to test and modify code changes before merging them into the stable master branch with the next release.
- Travis CI is configured to build and verify all PRs. If your PR causes the build to fail, please add an additional commit that resolves any problems.
- If you really want to earn some brownie points, create a JSFiddle that demonstrates your code changes. Seriously, this helps immensely and allows one or multiple people to easily provide feedback on the great work you've done.
- When creating the JSFiddle, keep in mind that you can use http://rawgit.com for your files.
- Do your best to fully test your changes. Anticipate edge-case behavior.
- Try to keep your codebase that you're making changes to as up-to-date as possible with the origin. SimpleMDE creates new releases frequently, so it's easy to fall behind if you've been working on something new for a while.

22
web/bower_components/simplemde/LICENSE vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Next Step Webs, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

331
web/bower_components/simplemde/README.md vendored Normal file
View File

@@ -0,0 +1,331 @@
# SimpleMDE - Markdown Editor
A drop-in JavaScript textarea replacement for writing beautiful and understandable Markdown. The WYSIWYG-esque editor allows users who may be less experienced with Markdown to use familiar toolbar buttons and shortcuts. In addition, the syntax is rendered while editing to clearly show the expected result. Headings are larger, emphasized words are italicized, links are underlined, etc. SimpleMDE is one of the first editors to feature both built-in autosaving and spell checking.
[**Demo**](https://simplemde.com)
[![Preview](http://i.imgur.com/zqWfJwO.png)](https://simplemde.com)
## Why not a WYSIWYG editor or pure Markdown?
WYSIWYG editors that produce HTML are often complex and buggy. Markdown solves this problem in many ways, plus Markdown can be rendered natively on more platforms than HTML. However, Markdown is not a syntax that an average user will be familiar with, nor is it visually clear while editing. In otherwords, for an unfamiliar user, the syntax they write will make little sense until they click the preview button. SimpleMDE has been designed to bridge this gap for non-technical users who are less familiar with or just learning Markdown syntax.
## Install
Via [npm](https://www.npmjs.com/package/simplemde).
```
npm install simplemde --save
```
Via [bower](https://www.bower.io).
```
bower install simplemde --save
```
Via [jsDelivr](https://www.jsdelivr.com/#!simplemde). *Please note, jsDelivr may take a few days to update to the latest release.*
```HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
```
## Quick start
After installing, load SimpleMDE on the first textarea on a page
```HTML
<script>
var simplemde = new SimpleMDE();
</script>
```
#### Using a specific textarea
Pure JavaScript method
```HTML
<script>
var simplemde = new SimpleMDE({ element: document.getElementById("MyID") });
</script>
```
jQuery method
```HTML
<script>
var simplemde = new SimpleMDE({ element: $("#MyID")[0] });
</script>
```
## Get/set the content
```JavaScript
simplemde.value();
```
```JavaScript
simplemde.value("This text will appear in the editor");
```
## Configuration
- **autoDownloadFontAwesome**: If set to `true`, force downloads Font Awesome (used for icons). If set to `false`, prevents downloading. Defaults to `undefined`, which will intelligently check whether Font Awesome has already been included, then download accordingly.
- **autofocus**: If set to `true`, autofocuses the editor. Defaults to `false`.
- **autosave**: *Saves the text that's being written and will load it back in the future. It will forget the text when the form it's contained in is submitted.*
- **enabled**: If set to `true`, autosave the text. Defaults to `false`.
- **delay**: Delay between saves, in milliseconds. Defaults to `10000` (10s).
- **uniqueId**: You must set a unique string identifier so that SimpleMDE can autosave. Something that separates this from other instances of SimpleMDE elsewhere on your website.
- **blockStyles**: Customize how certain buttons that style blocks of text behave.
- **bold** Can be set to `**` or `__`. Defaults to `**`.
- **code** Can be set to ```` ``` ```` or `~~~`. Defaults to ```` ``` ````.
- **italic** Can be set to `*` or `_`. Defaults to `*`.
- **element**: The DOM element for the textarea to use. Defaults to the first textarea on the page.
- **forceSync**: If set to `true`, force text changes made in SimpleMDE to be immediately stored in original textarea. Defaults to `false`.
- **hideIcons**: An array of icon names to hide. Can be used to hide specific icons shown by default without completely customizing the toolbar.
- **indentWithTabs**: If set to `false`, indent using spaces instead of tabs. Defaults to `true`.
- **initialValue**: If set, will customize the initial value of the editor.
- **insertTexts**: Customize how certain buttons that insert text behave. Takes an array with two elements. The first element will be the text inserted before the cursor or highlight, and the second element will be inserted after. For example, this is the default link value: `["[", "](http://)"]`.
- horizontalRule
- image
- link
- table
- **lineWrapping**: If set to `false`, disable line wrapping. Defaults to `true`.
- **parsingConfig**: Adjust settings for parsing the Markdown during editing (not previewing).
- **allowAtxHeaderWithoutSpace**: If set to `true`, will render headers without a space after the `#`. Defaults to `false`.
- **strikethrough**: If set to `false`, will not process GFM strikethrough syntax. Defaults to `true`.
- **underscoresBreakWords**: If set to `true`, let underscores be a delimiter for separating words. Defaults to `false`.
- **placeholder**: Custom placeholder that should be displayed
- **previewRender**: Custom function for parsing the plaintext Markdown and returning HTML. Used when user previews.
- **promptURLs**: If set to `true`, a JS alert window appears asking for the link or image URL. Defaults to `false`.
- **renderingConfig**: Adjust settings for parsing the Markdown during previewing (not editing).
- **singleLineBreaks**: If set to `false`, disable parsing GFM single line breaks. Defaults to `true`.
- **codeSyntaxHighlighting**: If set to `true`, will highlight using [highlight.js](https://github.com/isagalaev/highlight.js). Defaults to `false`. To use this feature you must include highlight.js on your page. For example, include the script and the CSS files like:<br>`<script src="https://cdn.jsdelivr.net/highlight.js/latest/highlight.min.js"></script>`<br>`<link rel="stylesheet" href="https://cdn.jsdelivr.net/highlight.js/latest/styles/github.min.css">`
- **shortcuts**: Keyboard shortcuts associated with this instance. Defaults to the [array of shortcuts](#keyboard-shortcuts).
- **showIcons**: An array of icon names to show. Can be used to show specific icons hidden by default without completely customizing the toolbar.
- **spellChecker**: If set to `false`, disable the spell checker. Defaults to `true`.
- **status**: If set to `false`, hide the status bar. Defaults to the array of built-in status bar items.
- Optionally, you can set an array of status bar items to include, and in what order. You can even define your own custom status bar items.
- **styleSelectedText**: If set to `false`, remove the `CodeMirror-selectedtext` class from selected lines. Defaults to `true`.
- **tabSize**: If set, customize the tab size. Defaults to `2`.
- **toolbar**: If set to `false`, hide the toolbar. Defaults to the [array of icons](#toolbar-icons).
- **toolbarTips**: If set to `false`, disable toolbar button tips. Defaults to `true`.
```JavaScript
// Most options demonstrate the non-default behavior
var simplemde = new SimpleMDE({
autofocus: true,
autosave: {
enabled: true,
uniqueId: "MyUniqueID",
delay: 1000,
},
blockStyles: {
bold: "__",
italic: "_"
},
element: document.getElementById("MyID"),
forceSync: true,
hideIcons: ["guide", "heading"],
indentWithTabs: false,
initialValue: "Hello world!",
insertTexts: {
horizontalRule: ["", "\n\n-----\n\n"],
image: ["![](http://", ")"],
link: ["[", "](http://)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
},
lineWrapping: false,
parsingConfig: {
allowAtxHeaderWithoutSpace: true,
strikethrough: false,
underscoresBreakWords: true,
},
placeholder: "Type here...",
previewRender: function(plainText) {
return customMarkdownParser(plainText); // Returns HTML from a custom parser
},
previewRender: function(plainText, preview) { // Async method
setTimeout(function(){
preview.innerHTML = customMarkdownParser(plainText);
}, 250);
return "Loading...";
},
promptURLs: true,
renderingConfig: {
singleLineBreaks: false,
codeSyntaxHighlighting: true,
},
shortcuts: {
drawTable: "Cmd-Alt-T"
},
showIcons: ["code", "table"],
spellChecker: false,
status: false,
status: ["autosave", "lines", "words", "cursor"], // Optional usage
status: ["autosave", "lines", "words", "cursor", {
className: "keystrokes",
defaultValue: function(el) {
this.keystrokes = 0;
el.innerHTML = "0 Keystrokes";
},
onUpdate: function(el) {
el.innerHTML = ++this.keystrokes + " Keystrokes";
}
}], // Another optional usage, with a custom status bar item that counts keystrokes
styleSelectedText: false,
tabSize: 4,
toolbar: false,
toolbarTips: false,
});
```
#### Toolbar icons
Below are the built-in toolbar icons (only some of which are enabled by default), which can be reorganized however you like. "Name" is the name of the icon, referenced in the JS. "Action" is either a function or a URL to open. "Class" is the class given to the icon. "Tooltip" is the small tooltip that appears via the `title=""` attribute. Note that shortcut hints are added automatically and reflect the specified action if it has a keybind assigned to it (i.e. with the value of `action` set to `bold` and that of `tooltip` set to `Bold`, the final text the user will see would be "Bold (Ctrl-B)").
Additionally, you can add a separator between any icons by adding `"|"` to the toolbar array.
Name | Action | Tooltip<br>Class
:--- | :----- | :--------------
bold | toggleBold | Bold<br>fa fa-bold
italic | toggleItalic | Italic<br>fa fa-italic
strikethrough | toggleStrikethrough | Strikethrough<br>fa fa-strikethrough
heading | toggleHeadingSmaller | Heading<br>fa fa-header
heading-smaller | toggleHeadingSmaller | Smaller Heading<br>fa fa-header
heading-bigger | toggleHeadingBigger | Bigger Heading<br>fa fa-lg fa-header
heading-1 | toggleHeading1 | Big Heading<br>fa fa-header fa-header-x fa-header-1
heading-2 | toggleHeading2 | Medium Heading<br>fa fa-header fa-header-x fa-header-2
heading-3 | toggleHeading3 | Small Heading<br>fa fa-header fa-header-x fa-header-3
code | toggleCodeBlock | Code<br>fa fa-code
quote | toggleBlockquote | Quote<br>fa fa-quote-left
unordered-list | toggleUnorderedList | Generic List<br>fa fa-list-ul
ordered-list | toggleOrderedList | Numbered List<br>fa fa-list-ol
clean-block | cleanBlock | Clean block<br>fa fa-eraser fa-clean-block
link | drawLink | Create Link<br>fa fa-link
image | drawImage | Insert Image<br>fa fa-picture-o
table | drawTable | Insert Table<br>fa fa-table
horizontal-rule | drawHorizontalRule | Insert Horizontal Line<br>fa fa-minus
preview | togglePreview | Toggle Preview<br>fa fa-eye no-disable
side-by-side | toggleSideBySide | Toggle Side by Side<br>fa fa-columns no-disable no-mobile
fullscreen | toggleFullScreen | Toggle Fullscreen<br>fa fa-arrows-alt no-disable no-mobile
guide | [This link](https://simplemde.com/markdown-guide) | Markdown Guide<br>fa fa-question-circle
Customize the toolbar using the `toolbar` option like:
```JavaScript
// Customize only the order of existing buttons
var simplemde = new SimpleMDE({
toolbar: ["bold", "italic", "heading", "|", "quote"],
});
// Customize all information and/or add your own icons
var simplemde = new SimpleMDE({
toolbar: [{
name: "bold",
action: SimpleMDE.toggleBold,
className: "fa fa-bold",
title: "Bold",
},
{
name: "custom",
action: function customFunction(editor){
// Add your own code
},
className: "fa fa-star",
title: "Custom Button",
},
"|", // Separator
...
],
});
```
#### Keyboard shortcuts
SimpleMDE comes with an array of predefined keyboard shortcuts, but they can be altered with a configuration option. The list of default ones is as follows:
Shortcut | Action
:------- | :-----
*Cmd-'* | "toggleBlockquote"
*Cmd-B* | "toggleBold"
*Cmd-E* | "cleanBlock"
*Cmd-H* | "toggleHeadingSmaller"
*Cmd-I* | "toggleItalic"
*Cmd-K* | "drawLink"
*Cmd-L* | "toggleUnorderedList"
*Cmd-P* | "togglePreview"
*Cmd-Alt-C* | "toggleCodeBlock"
*Cmd-Alt-I* | "drawImage"
*Cmd-Alt-L* | "toggleOrderedList"
*Shift-Cmd-H* | "toggleHeadingBigger"
*F9* | "toggleSideBySide"
*F11* | "toggleFullScreen"
Here is how you can change a few, while leaving others untouched:
```JavaScript
var simplemde = new SimpleMDE({
shortcuts: {
"toggleOrderedList": "Ctrl-Alt-K", // alter the shortcut for toggleOrderedList
"toggleCodeBlock": null, // unbind Ctrl-Alt-C
"drawTable": "Cmd-Alt-T" // bind Cmd-Alt-T to drawTable action, which doesn't come with a default shortcut
}
});
```
Shortcuts are automatically converted between platforms. If you define a shortcut as "Cmd-B", on PC that shortcut will be changed to "Ctrl-B". Conversely, a shortcut defined as "Ctrl-B" will become "Cmd-B" for Mac users.
The list of actions that can be bound is the same as the list of built-in actions available for [toolbar buttons](#toolbar-icons).
#### Height
To change the minimum height (before it starts auto-growing):
```CSS
.CodeMirror, .CodeMirror-scroll {
min-height: 200px;
}
```
Or, you can keep the height static:
```CSS
.CodeMirror {
height: 300px;
}
```
## Event handling
You can catch the following list of events: https://codemirror.net/doc/manual.html#events
```JavaScript
var simplemde = new SimpleMDE();
simplemde.codemirror.on("change", function(){
console.log(simplemde.value());
});
```
## Removing SimpleMDE from textarea
You can revert to the initial textarea by calling the `toTextArea` method. Note that this clears up the autosave (if enabled) associated with it. The textarea will retain any text from the destroyed SimpleMDE instance.
```JavaScript
var simplemde = new SimpleMDE();
...
simplemde.toTextArea();
simplemde = null;
```
## Useful methods
The following self-explanatory methods may be of use while developing with SimpleMDE.
```js
var simplemde = new SimpleMDE();
simplemde.isPreviewActive(); // returns boolean
simplemde.isSideBySideActive(); // returns boolean
simplemde.isFullscreenActive(); // returns boolean
simplemde.clearAutosavedValue(); // no returned value
```
## How it works
SimpleMDE began as an improvement of [lepture's Editor project](https://github.com/lepture/editor), but has now taken on an identity of its own. It is bundled with [CodeMirror](https://github.com/codemirror/codemirror) and depends on [Font Awesome](http://fontawesome.io).
CodeMirror is the backbone of the project and parses much of the Markdown syntax as it's being written. This allows us to add styles to the Markdown that's being written. Additionally, a toolbar and status bar have been added to the top and bottom, respectively. Previews are rendered by [Marked](https://github.com/chjj/marked) using GFM.

View File

@@ -0,0 +1,23 @@
{
"name": "simplemde",
"version": "1.11.2",
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"authors": [
"Wes Cossick <https://wescossick.com>"
],
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor.",
"main": ["src/js/simplemde.js", "src/css/simplemde.css"],
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"wysiwyg"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components"
]
}

View File

@@ -0,0 +1,676 @@
/**
* simplemde v1.11.2
* Copyright Next Step Webs, Inc.
* @link https://github.com/NextStepWebs/simplemde-markdown-editor
* @license MIT
*/
/* BASICS */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
color: black;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }
/* CURSOR */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0 !important;
background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
.cm-animate-fat-cursor {
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-moz-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@-webkit-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}
.cm-tab { display: inline-block; text-decoration: inherit; }
.CodeMirror-ruler {
border-left: 1px solid #ccc;
position: absolute;
}
/* DEFAULT THEME */
.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3 {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}
.CodeMirror-composing { border-bottom: 2px solid; }
/* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
.CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px;
padding-bottom: 30px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
}
.CodeMirror-sizer {
position: relative;
border-right: 30px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actual scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
min-height: 100%;
z-index: 3;
}
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
/* Hack to make IE7 behave */
*zoom:1;
*display:inline;
}
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
.CodeMirror-gutter-background {
position: absolute;
top: 0; bottom: 0;
z-index: 4;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-gutter-wrapper {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.CodeMirror-lines {
cursor: text;
min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
overflow: auto;
}
.CodeMirror-widget {}
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-cursor { position: absolute; }
.CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background: #ffa;
background: rgba(255, 255, 0, .4);
}
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
.CodeMirror span { *vertical-align: text-bottom; }
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }
/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }
.CodeMirror {
height: auto;
min-height: 300px;
border: 1px solid #ddd;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
padding: 10px;
font: inherit;
z-index: 1;
}
.CodeMirror-scroll {
min-height: 300px
}
.CodeMirror-fullscreen {
background: #fff;
position: fixed !important;
top: 50px;
left: 0;
right: 0;
bottom: 0;
height: auto;
z-index: 9;
}
.CodeMirror-sided {
width: 50% !important;
}
.editor-toolbar {
position: relative;
opacity: .6;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
padding: 0 10px;
border-top: 1px solid #bbb;
border-left: 1px solid #bbb;
border-right: 1px solid #bbb;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.editor-toolbar:after,
.editor-toolbar:before {
display: block;
content: ' ';
height: 1px;
}
.editor-toolbar:before {
margin-bottom: 8px
}
.editor-toolbar:after {
margin-top: 8px
}
.editor-toolbar:hover,
.editor-wrapper input.title:focus,
.editor-wrapper input.title:hover {
opacity: .8
}
.editor-toolbar.fullscreen {
width: 100%;
height: 50px;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
padding-top: 10px;
padding-bottom: 10px;
box-sizing: border-box;
background: #fff;
border: 0;
position: fixed;
top: 0;
left: 0;
opacity: 1;
z-index: 9;
}
.editor-toolbar.fullscreen::before {
width: 20px;
height: 50px;
background: -moz-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(100%, rgba(255, 255, 255, 0)));
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: -o-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: -ms-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
position: fixed;
top: 0;
left: 0;
margin: 0;
padding: 0;
}
.editor-toolbar.fullscreen::after {
width: 20px;
height: 50px;
background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(100%, rgba(255, 255, 255, 1)));
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
position: fixed;
top: 0;
right: 0;
margin: 0;
padding: 0;
}
.editor-toolbar a {
display: inline-block;
text-align: center;
text-decoration: none!important;
color: #2c3e50!important;
width: 30px;
height: 30px;
margin: 0;
border: 1px solid transparent;
border-radius: 3px;
cursor: pointer;
}
.editor-toolbar a.active,
.editor-toolbar a:hover {
background: #fcfcfc;
border-color: #95a5a6;
}
.editor-toolbar a:before {
line-height: 30px
}
.editor-toolbar i.separator {
display: inline-block;
width: 0;
border-left: 1px solid #d9d9d9;
border-right: 1px solid #fff;
color: transparent;
text-indent: -10px;
margin: 0 6px;
}
.editor-toolbar a.fa-header-x:after {
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 65%;
vertical-align: text-bottom;
position: relative;
top: 2px;
}
.editor-toolbar a.fa-header-1:after {
content: "1";
}
.editor-toolbar a.fa-header-2:after {
content: "2";
}
.editor-toolbar a.fa-header-3:after {
content: "3";
}
.editor-toolbar a.fa-header-bigger:after {
content: "▲";
}
.editor-toolbar a.fa-header-smaller:after {
content: "▼";
}
.editor-toolbar.disabled-for-preview a:not(.no-disable) {
pointer-events: none;
background: #fff;
border-color: transparent;
text-shadow: inherit;
}
@media only screen and (max-width: 700px) {
.editor-toolbar a.no-mobile {
display: none;
}
}
.editor-statusbar {
padding: 8px 10px;
font-size: 12px;
color: #959694;
text-align: right;
}
.editor-statusbar span {
display: inline-block;
min-width: 4em;
margin-left: 1em;
}
.editor-statusbar .lines:before {
content: 'lines: '
}
.editor-statusbar .words:before {
content: 'words: '
}
.editor-statusbar .characters:before {
content: 'characters: '
}
.editor-preview {
padding: 10px;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #fafafa;
z-index: 7;
overflow: auto;
display: none;
box-sizing: border-box;
}
.editor-preview-side {
padding: 10px;
position: fixed;
bottom: 0;
width: 50%;
top: 50px;
right: 0;
background: #fafafa;
z-index: 9;
overflow: auto;
display: none;
box-sizing: border-box;
border: 1px solid #ddd;
}
.editor-preview-active-side {
display: block
}
.editor-preview-active {
display: block
}
.editor-preview>p,
.editor-preview-side>p {
margin-top: 0
}
.editor-preview pre,
.editor-preview-side pre {
background: #eee;
margin-bottom: 10px;
}
.editor-preview table td,
.editor-preview table th,
.editor-preview-side table td,
.editor-preview-side table th {
border: 1px solid #ddd;
padding: 5px;
}
.CodeMirror .CodeMirror-code .cm-tag {
color: #63a35c;
}
.CodeMirror .CodeMirror-code .cm-attribute {
color: #795da3;
}
.CodeMirror .CodeMirror-code .cm-string {
color: #183691;
}
.CodeMirror .CodeMirror-selected {
background: #d9d9d9;
}
.CodeMirror .CodeMirror-code .cm-header-1 {
font-size: 200%;
line-height: 200%;
}
.CodeMirror .CodeMirror-code .cm-header-2 {
font-size: 160%;
line-height: 160%;
}
.CodeMirror .CodeMirror-code .cm-header-3 {
font-size: 125%;
line-height: 125%;
}
.CodeMirror .CodeMirror-code .cm-header-4 {
font-size: 110%;
line-height: 110%;
}
.CodeMirror .CodeMirror-code .cm-comment {
background: rgba(0, 0, 0, .05);
border-radius: 2px;
}
.CodeMirror .CodeMirror-code .cm-link {
color: #7f8c8d;
}
.CodeMirror .CodeMirror-code .cm-url {
color: #aab2b3;
}
.CodeMirror .CodeMirror-code .cm-strikethrough {
text-decoration: line-through;
}
.CodeMirror .CodeMirror-placeholder {
opacity: .5;
}
.CodeMirror .cm-spell-error:not(.cm-url):not(.cm-comment):not(.cm-tag):not(.cm-word) {
background: rgba(255, 0, 0, .15);
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,96 @@
"use strict";
var gulp = require("gulp"),
minifycss = require("gulp-clean-css"),
uglify = require("gulp-uglify"),
concat = require("gulp-concat"),
header = require("gulp-header"),
buffer = require("vinyl-buffer"),
pkg = require("./package.json"),
debug = require("gulp-debug"),
eslint = require("gulp-eslint"),
prettify = require("gulp-jsbeautifier"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
rename = require("gulp-rename");
var banner = ["/**",
" * <%= pkg.name %> v<%= pkg.version %>",
" * Copyright <%= pkg.company %>",
" * @link <%= pkg.homepage %>",
" * @license <%= pkg.license %>",
" */",
""].join("\n");
gulp.task("prettify-js", [], function() {
return gulp.src("./src/js/simplemde.js")
.pipe(prettify({js: {brace_style: "collapse", indent_char: "\t", indent_size: 1, max_preserve_newlines: 3, space_before_conditional: false}}))
.pipe(gulp.dest("./src/js"));
});
gulp.task("prettify-css", [], function() {
return gulp.src("./src/css/simplemde.css")
.pipe(prettify({css: {indentChar: "\t", indentSize: 1}}))
.pipe(gulp.dest("./src/css"));
});
gulp.task("lint", ["prettify-js"], function() {
gulp.src("./src/js/**/*.js")
.pipe(debug())
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
function taskBrowserify(opts) {
return browserify("./src/js/simplemde.js", opts)
.bundle();
}
gulp.task("browserify:debug", ["lint"], function() {
return taskBrowserify({debug:true, standalone:"SimpleMDE"})
.pipe(source("simplemde.debug.js"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"));
});
gulp.task("browserify", ["lint"], function() {
return taskBrowserify({standalone:"SimpleMDE"})
.pipe(source("simplemde.js"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"));
});
gulp.task("scripts", ["browserify:debug", "browserify", "lint"], function() {
var js_files = ["./debug/simplemde.js"];
return gulp.src(js_files)
.pipe(concat("simplemde.min.js"))
.pipe(uglify())
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./dist/"));
});
gulp.task("styles", ["prettify-css"], function() {
var css_files = [
"./node_modules/codemirror/lib/codemirror.css",
"./src/css/*.css",
"./node_modules/codemirror-spell-checker/src/css/spell-checker.css"
];
return gulp.src(css_files)
.pipe(concat("simplemde.css"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./debug/"))
.pipe(minifycss())
.pipe(rename("simplemde.min.css"))
.pipe(buffer())
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest("./dist/"));
});
gulp.task("default", ["scripts", "styles"]);

View File

@@ -0,0 +1,48 @@
{
"name": "simplemde",
"version": "1.11.2",
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor. Features autosaving and spell checking.",
"keywords": [
"embeddable",
"markdown",
"editor",
"javascript",
"wysiwyg"
],
"homepage": "https://github.com/NextStepWebs/simplemde-markdown-editor",
"main": "./src/js/simplemde.js",
"license": "MIT",
"company": "Next Step Webs, Inc.",
"author": {
"name": "Wes Cossick",
"url": "http://www.WesCossick.com"
},
"bugs": {
"url": "https://github.com/NextStepWebs/simplemde-markdown-editor/issues"
},
"dependencies": {
"codemirror": "*",
"codemirror-spell-checker": "*",
"marked": "*"
},
"devDependencies": {
"browserify": "*",
"debug": "*",
"eslint": "*",
"gulp": "*",
"gulp-concat": "*",
"gulp-debug": "*",
"gulp-eslint": "*",
"gulp-header": "*",
"gulp-jsbeautifier": "*",
"gulp-clean-css": "*",
"gulp-rename": "*",
"gulp-uglify": "*",
"vinyl-source-stream": "*",
"vinyl-buffer": "*"
},
"repository": {
"type": "git",
"url": "https://github.com/NextStepWebs/simplemde-markdown-editor"
}
}

View File

@@ -0,0 +1,328 @@
.CodeMirror {
height: auto;
min-height: 300px;
border: 1px solid #ddd;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
padding: 10px;
font: inherit;
z-index: 1;
}
.CodeMirror-scroll {
min-height: 300px
}
.CodeMirror-fullscreen {
background: #fff;
position: fixed !important;
top: 50px;
left: 0;
right: 0;
bottom: 0;
height: auto;
z-index: 9;
}
.CodeMirror-sided {
width: 50% !important;
}
.editor-toolbar {
position: relative;
opacity: .6;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
padding: 0 10px;
border-top: 1px solid #bbb;
border-left: 1px solid #bbb;
border-right: 1px solid #bbb;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.editor-toolbar:after,
.editor-toolbar:before {
display: block;
content: ' ';
height: 1px;
}
.editor-toolbar:before {
margin-bottom: 8px
}
.editor-toolbar:after {
margin-top: 8px
}
.editor-toolbar:hover,
.editor-wrapper input.title:focus,
.editor-wrapper input.title:hover {
opacity: .8
}
.editor-toolbar.fullscreen {
width: 100%;
height: 50px;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
padding-top: 10px;
padding-bottom: 10px;
box-sizing: border-box;
background: #fff;
border: 0;
position: fixed;
top: 0;
left: 0;
opacity: 1;
z-index: 9;
}
.editor-toolbar.fullscreen::before {
width: 20px;
height: 50px;
background: -moz-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(100%, rgba(255, 255, 255, 0)));
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: -o-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: -ms-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
background: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
position: fixed;
top: 0;
left: 0;
margin: 0;
padding: 0;
}
.editor-toolbar.fullscreen::after {
width: 20px;
height: 50px;
background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(100%, rgba(255, 255, 255, 1)));
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
position: fixed;
top: 0;
right: 0;
margin: 0;
padding: 0;
}
.editor-toolbar a {
display: inline-block;
text-align: center;
text-decoration: none!important;
color: #2c3e50!important;
width: 30px;
height: 30px;
margin: 0;
border: 1px solid transparent;
border-radius: 3px;
cursor: pointer;
}
.editor-toolbar a.active,
.editor-toolbar a:hover {
background: #fcfcfc;
border-color: #95a5a6;
}
.editor-toolbar a:before {
line-height: 30px
}
.editor-toolbar i.separator {
display: inline-block;
width: 0;
border-left: 1px solid #d9d9d9;
border-right: 1px solid #fff;
color: transparent;
text-indent: -10px;
margin: 0 6px;
}
.editor-toolbar a.fa-header-x:after {
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size: 65%;
vertical-align: text-bottom;
position: relative;
top: 2px;
}
.editor-toolbar a.fa-header-1:after {
content: "1";
}
.editor-toolbar a.fa-header-2:after {
content: "2";
}
.editor-toolbar a.fa-header-3:after {
content: "3";
}
.editor-toolbar a.fa-header-bigger:after {
content: "▲";
}
.editor-toolbar a.fa-header-smaller:after {
content: "▼";
}
.editor-toolbar.disabled-for-preview a:not(.no-disable) {
pointer-events: none;
background: #fff;
border-color: transparent;
text-shadow: inherit;
}
@media only screen and (max-width: 700px) {
.editor-toolbar a.no-mobile {
display: none;
}
}
.editor-statusbar {
padding: 8px 10px;
font-size: 12px;
color: #959694;
text-align: right;
}
.editor-statusbar span {
display: inline-block;
min-width: 4em;
margin-left: 1em;
}
.editor-statusbar .lines:before {
content: 'lines: '
}
.editor-statusbar .words:before {
content: 'words: '
}
.editor-statusbar .characters:before {
content: 'characters: '
}
.editor-preview {
padding: 10px;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #fafafa;
z-index: 7;
overflow: auto;
display: none;
box-sizing: border-box;
}
.editor-preview-side {
padding: 10px;
position: fixed;
bottom: 0;
width: 50%;
top: 50px;
right: 0;
background: #fafafa;
z-index: 9;
overflow: auto;
display: none;
box-sizing: border-box;
border: 1px solid #ddd;
}
.editor-preview-active-side {
display: block
}
.editor-preview-active {
display: block
}
.editor-preview>p,
.editor-preview-side>p {
margin-top: 0
}
.editor-preview pre,
.editor-preview-side pre {
background: #eee;
margin-bottom: 10px;
}
.editor-preview table td,
.editor-preview table th,
.editor-preview-side table td,
.editor-preview-side table th {
border: 1px solid #ddd;
padding: 5px;
}
.CodeMirror .CodeMirror-code .cm-tag {
color: #63a35c;
}
.CodeMirror .CodeMirror-code .cm-attribute {
color: #795da3;
}
.CodeMirror .CodeMirror-code .cm-string {
color: #183691;
}
.CodeMirror .CodeMirror-selected {
background: #d9d9d9;
}
.CodeMirror .CodeMirror-code .cm-header-1 {
font-size: 200%;
line-height: 200%;
}
.CodeMirror .CodeMirror-code .cm-header-2 {
font-size: 160%;
line-height: 160%;
}
.CodeMirror .CodeMirror-code .cm-header-3 {
font-size: 125%;
line-height: 125%;
}
.CodeMirror .CodeMirror-code .cm-header-4 {
font-size: 110%;
line-height: 110%;
}
.CodeMirror .CodeMirror-code .cm-comment {
background: rgba(0, 0, 0, .05);
border-radius: 2px;
}
.CodeMirror .CodeMirror-code .cm-link {
color: #7f8c8d;
}
.CodeMirror .CodeMirror-code .cm-url {
color: #aab2b3;
}
.CodeMirror .CodeMirror-code .cm-strikethrough {
text-decoration: line-through;
}
.CodeMirror .CodeMirror-placeholder {
opacity: .5;
}

View File

@@ -0,0 +1,44 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
var CodeMirror = require("codemirror");
CodeMirror.commands.tabAndIndentMarkdownList = function (cm) {
var ranges = cm.listSelections();
var pos = ranges[0].head;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;
if (inList) {
cm.execCommand("indentMore");
return;
}
if (cm.options.indentWithTabs) {
cm.execCommand("insertTab");
}
else {
var spaces = Array(cm.options.tabSize + 1).join(" ");
cm.replaceSelection(spaces);
}
};
CodeMirror.commands.shiftTabAndUnindentMarkdownList = function (cm) {
var ranges = cm.listSelections();
var pos = ranges[0].head;
var eolState = cm.getStateAfter(pos.line);
var inList = eolState.list !== false;
if (inList) {
cm.execCommand("indentLess");
return;
}
if (cm.options.indentWithTabs) {
cm.execCommand("insertTab");
}
else {
var spaces = Array(cm.options.tabSize + 1).join(" ");
cm.replaceSelection(spaces);
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
{
"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"
],
"version": "4.5.5",
"_release": "4.5.5",
"_resolution": {
"type": "version",
"tag": "4.5.5",
"commit": "d6dda8ceadf741fce2cf808790080a589877d6e6"
},
"_source": "https://github.com/tinymce/tinymce-dist.git",
"_target": "^4.5.5",
"_originalSource": "tinymce",
"_direct": true
}

21
web/bower_components/tinymce/bower.json vendored Normal file
View 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"
]
}

View 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);

View File

@@ -0,0 +1 @@
!function(e){function t(){function t(e){"remove"===e&&this.each(function(e,t){var n=i(t);n&&n.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(e,t){var n=tinymce.get(t.id.replace(/_parent$/,""));n&&n.remove()})}function r(e){var n,r=this;if(null!=e)t.call(r),r.each(function(t,n){var r;(r=tinymce.get(n.id))&&r.setContent(e)});else if(r.length>0&&(n=tinymce.get(r[0].id)))return n.getContent()}function i(e){var t=null;return e&&e.id&&a.tinymce&&(t=tinymce.get(e.id)),t}function o(e){return!!(e&&e.length&&a.tinymce&&e.is(":tinymce"))}var s={};e.each(["text","html","val"],function(t,a){var l=s[a]=e.fn[a],c="text"===a;e.fn[a]=function(t){var a=this;if(!o(a))return l.apply(a,arguments);if(t!==n)return r.call(a.filter(":tinymce"),t),l.apply(a.not(":tinymce"),arguments),a;var s="",u=arguments;return(c?a:a.eq(0)).each(function(t,n){var r=i(n);s+=r?c?r.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):r.getContent({save:!0}):l.apply(e(n),u)}),s}}),e.each(["append","prepend"],function(t,r){var a=s[r]=e.fn[r],l="prepend"===r;e.fn[r]=function(e){var t=this;return o(t)?e!==n?("string"==typeof e&&t.filter(":tinymce").each(function(t,n){var r=i(n);r&&r.setContent(l?e+r.getContent():r.getContent()+e)}),a.apply(t.not(":tinymce"),arguments),t):void 0:a.apply(t,arguments)}}),e.each(["remove","replaceWith","replaceAll","empty"],function(n,r){var i=s[r]=e.fn[r];e.fn[r]=function(){return t.call(this,r),i.apply(this,arguments)}}),s.attr=e.fn.attr,e.fn.attr=function(t,a){var l=this,c=arguments;if(!t||"value"!==t||!o(l))return a!==n?s.attr.apply(l,c):s.attr.apply(l,c);if(a!==n)return r.call(l.filter(":tinymce"),a),s.attr.apply(l.not(":tinymce"),c),l;var u=l[0],d=i(u);return d?d.getContent({save:!0}):s.attr.apply(e(u),c)}}var n,r,i,o=[],a=window;e.fn.tinymce=function(n){function s(){var r=[],o=0;i||(t(),i=!0),d.each(function(e,t){var i,a=t.id,s=n.oninit;a||(t.id=a=tinymce.DOM.uniqueId()),tinymce.get(a)||(i=new tinymce.Editor(a,n,tinymce.EditorManager),r.push(i),i.on("init",function(){var e,t=s;d.css("visibility",""),s&&++o==r.length&&("string"==typeof t&&(e=t.indexOf(".")===-1?null:tinymce.resolve(t.replace(/\.\w+$/,"")),t=tinymce.resolve(t)),t.apply(e||tinymce,r))}))}),e.each(r,function(e,t){t.render()})}var l,c,u,d=this,f="";if(!d.length)return d;if(!n)return window.tinymce?tinymce.get(d[0].id):null;if(d.css("visibility","hidden"),a.tinymce||r||!(l=n.script_url))1===r?o.push(s):s();else{r=1,c=l.substring(0,l.lastIndexOf("/")),l.indexOf(".min")!=-1&&(f=".min"),a.tinymce=a.tinyMCEPreInit||{base:c,suffix:f},l.indexOf("gzip")!=-1&&(u=n.language||"en",l=l+(/\?/.test(l)?"&":"?")+"js=true&core=true&suffix="+escape(f)+"&themes="+escape(n.theme||"modern")+"&plugins="+escape(n.plugins||"")+"&languages="+(u||""),a.tinyMCE_GZ||(a.tinyMCE_GZ={start:function(){function t(e){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(e))}t("langs/"+u+".js"),t("themes/"+n.theme+"/theme"+f+".js"),t("themes/"+n.theme+"/langs/"+u+".js"),e.each(n.plugins.split(","),function(e,n){n&&(t("plugins/"+n+"/plugin"+f+".js"),t("plugins/"+n+"/langs/"+u+".js"))})},end:function(){}}));var p=document.createElement("script");p.type="text/javascript",p.onload=p.onreadystatechange=function(t){t=t||window.event,2===r||"load"!=t.type&&!/complete|loaded/.test(p.readyState)||(tinymce.dom.Event.domLoaded=1,r=2,n.script_loaded&&n.script_loaded(),s(),e.each(o,function(e,t){t()}))},p.src=l,document.body.appendChild(p)}return d},e.extend(e.expr[":"],{tinymce:function(e){var t;return!!(e.id&&"tinymce"in window&&(t=tinymce.get(e.id),t&&t.editorManager===tinymce))}})}(jQuery);

504
web/bower_components/tinymce/license.txt vendored Normal file
View 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!

View File

@@ -0,0 +1,7 @@
// Exports the "advlist" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/advlist')
// ES2015:
// import 'tinymce/plugins/advlist'
require('./plugin.js');

View File

@@ -0,0 +1,139 @@
/**
* 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;
var hasPlugin = function (editor, plugin) {
var plugins = editor.settings.plugins ? editor.settings.plugins : '';
return tinymce.util.Tools.inArray(plugins.split(/[ ,]/), plugin) !== -1;
};
function isChildOfBody(elm) {
return editor.$.contains(editor.getBody(), elm);
}
function isListNode(node) {
return node && (/^(OL|UL|DL)$/).test(node.nodeName) && isChildOfBody(node);
}
function buildMenuItems(listName, styleValues) {
var items = [];
if (styleValues) {
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);
}
list = dom.getParent(sel.getNode(), 'ol,ul');
if (list) {
tinymce.util.Tools.each(dom.select('ol,ul', list).concat([list]), function (list) {
if (list.nodeName !== listName && styleValue !== false) {
list = dom.rename(list, listName);
}
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);
});
}
var listState = function (listName) {
return function () {
var self = this;
editor.on('NodeChange', function (e) {
var lists = tinymce.util.Tools.grep(e.parents, isListNode);
self.active(lists.length > 0 && lists[0].nodeName === listName);
});
};
};
if (hasPlugin(editor, "lists")) {
editor.addCommand('ApplyUnorderedListStyle', function (ui, value) {
applyListFormat('UL', value['list-style-type']);
});
editor.addCommand('ApplyOrderedListStyle', function (ui, value) {
applyListFormat('OL', value['list-style-type']);
});
editor.addButton('numlist', {
type: (olMenuItems.length > 0) ? 'splitbutton' : 'button',
tooltip: 'Numbered list',
menu: olMenuItems,
onPostRender: listState('OL'),
onshow: updateSelection,
onselect: function(e) {
applyListFormat('OL', e.control.settings.data);
},
onclick: function() {
applyListFormat('OL', false);
}
});
editor.addButton('bullist', {
type: (ulMenuItems.length > 0) ? 'splitbutton' : 'button',
tooltip: 'Bullet list',
onPostRender: listState('UL'),
menu: ulMenuItems,
onshow: updateSelection,
onselect: function(e) {
applyListFormat('UL', e.control.settings.data);
},
onclick: function() {
applyListFormat('UL', false);
}
});
}
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("advlist",function(e){function t(t){return e.$.contains(e.getBody(),t)}function n(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)&&t(e)}function r(e,t){var n=[];return t&&tinymce.each(t.split(/[ ,]/),function(e){n.push({text:e.replace(/\-/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}),data:"default"==e?"":e})}),n}function i(t,n){e.undoManager.transact(function(){var r,i=e.dom,o=e.selection;if(r=i.getParent(o.getNode(),"ol,ul"),!r||r.nodeName!=t||n===!1){var a={"list-style-type":n?n:""};e.execCommand("UL"==t?"InsertUnorderedList":"InsertOrderedList",!1,a)}r=i.getParent(o.getNode(),"ol,ul"),r&&tinymce.util.Tools.each(i.select("ol,ul",r).concat([r]),function(e){e.nodeName!==t&&n!==!1&&(e=i.rename(e,t)),i.setStyle(e,"listStyleType",n?n:null),e.removeAttribute("data-mce-style")}),e.focus()})}function o(t){var n=e.dom.getStyle(e.dom.getParent(e.selection.getNode(),"ol,ul"),"listStyleType")||"";t.control.items().each(function(e){e.active(e.settings.data===n)})}var a,s,l=function(e,t){var n=e.settings.plugins?e.settings.plugins:"";return tinymce.util.Tools.inArray(n.split(/[ ,]/),t)!==-1};a=r("OL",e.getParam("advlist_number_styles","default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman")),s=r("UL",e.getParam("advlist_bullet_styles","default,circle,disc,square"));var c=function(t){return function(){var r=this;e.on("NodeChange",function(e){var i=tinymce.util.Tools.grep(e.parents,n);r.active(i.length>0&&i[0].nodeName===t)})}};l(e,"lists")&&(e.addCommand("ApplyUnorderedListStyle",function(e,t){i("UL",t["list-style-type"])}),e.addCommand("ApplyOrderedListStyle",function(e,t){i("OL",t["list-style-type"])}),e.addButton("numlist",{type:a.length>0?"splitbutton":"button",tooltip:"Numbered list",menu:a,onPostRender:c("OL"),onshow:o,onselect:function(e){i("OL",e.control.settings.data)},onclick:function(){i("OL",!1)}}),e.addButton("bullist",{type:s.length>0?"splitbutton":"button",tooltip:"Bullet list",onPostRender:c("UL"),menu:s,onshow:o,onselect:function(e){i("UL",e.control.settings.data)},onclick:function(){i("UL",!1)}}))});

View File

@@ -0,0 +1,7 @@
// Exports the "anchor" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/anchor')
// ES2015:
// import 'tinymce/plugins/anchor'
require('./plugin.js');

View File

@@ -0,0 +1,91 @@
/**
* 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) {
var isAnchorNode = function (node) {
return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild;
};
var setContentEditable = function (state) {
return function (nodes) {
for (var i = 0; i < nodes.length; i++) {
if (isAnchorNode(nodes[i])) {
nodes[i].attr('contenteditable', state);
}
}
};
};
var isValidId = function (id) {
// Follows HTML4 rules: https://www.w3.org/TR/html401/types.html#type-id
return /^[A-Za-z][A-Za-z0-9\-:._]*$/.test(id);
};
var showDialog = function () {
var selectedNode = editor.selection.getNode();
var isAnchor = selectedNode.tagName == 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
var value = '';
if (isAnchor) {
value = selectedNode.id || selectedNode.name || '';
}
editor.windowManager.open({
title: 'Anchor',
body: {type: 'textbox', name: 'id', size: 40, label: 'Id', value: value},
onsubmit: function(e) {
var id = e.data.id;
if (!isValidId(id)) {
e.preventDefault();
editor.windowManager.alert(
'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.'
);
return;
}
if (isAnchor) {
selectedNode.removeAttribute('name');
selectedNode.id = id;
} else {
editor.selection.collapse(true);
editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
id: id
}));
}
}
});
};
if (tinymce.Env.ceFalse) {
editor.on('PreInit', function () {
editor.parser.addNodeFilter('a', setContentEditable('false'));
editor.serializer.addNodeFilter('a', setContentEditable(null));
});
}
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
});
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("anchor",function(e){var t=function(e){return!e.attr("href")&&(e.attr("id")||e.attr("name"))&&!e.firstChild},n=function(e){return function(n){for(var r=0;r<n.length;r++)t(n[r])&&n[r].attr("contenteditable",e)}},r=function(e){return/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(e)},i=function(){var t=e.selection.getNode(),n="A"==t.tagName&&""===e.dom.getAttrib(t,"href"),i="";n&&(i=t.id||t.name||""),e.windowManager.open({title:"Anchor",body:{type:"textbox",name:"id",size:40,label:"Id",value:i},onsubmit:function(i){var o=i.data.id;return r(o)?void(n?(t.removeAttribute("name"),t.id=o):(e.selection.collapse(!0),e.execCommand("mceInsertContent",!1,e.dom.createHTML("a",{id:o})))):(i.preventDefault(),void e.windowManager.alert("Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."))}})};tinymce.Env.ceFalse&&e.on("PreInit",function(){e.parser.addNodeFilter("a",n("false")),e.serializer.addNodeFilter("a",n(null))}),e.addCommand("mceAnchor",i),e.addButton("anchor",{icon:"anchor",tooltip:"Anchor",onclick:i,stateSelector:"a:not([href])"}),e.addMenuItem("anchor",{icon:"anchor",text:"Anchor",context:"insert",onclick:i})});

View File

@@ -0,0 +1,7 @@
// Exports the "autolink" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/autolink')
// ES2015:
// import 'tinymce/plugins/autolink'
require('./plugin.js');

View File

@@ -0,0 +1,209 @@
/**
* 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, &nbsp;, 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]);
if (editor.settings.default_link_target) {
editor.dom.setAttrib(editor.selection.getNode(), 'target', editor.settings.default_link_target);
}
editor.selection.moveToBookmark(bookmark);
editor.nodeChanged();
}
}
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("autolink",function(e){function t(e){i(e,-1,"(",!0)}function n(e){i(e,0,"",!0)}function r(e){i(e,-1,"",!1)}function i(e,t,n){function r(e,t){if(t<0&&(t=0),3==e.nodeType){var n=e.data.length;t>n&&(t=n)}return t}function i(e,t){1!=e.nodeType||e.hasChildNodes()?s.setStart(e,r(e,t)):s.setStartBefore(e)}function o(e,t){1!=e.nodeType||e.hasChildNodes()?s.setEnd(e,r(e,t)):s.setEndAfter(e)}var s,l,c,u,d,f,p,m,g,h;if("A"!=e.selection.getNode().tagName){if(s=e.selection.getRng(!0).cloneRange(),s.startOffset<5){if(m=s.endContainer.previousSibling,!m){if(!s.endContainer.firstChild||!s.endContainer.firstChild.nextSibling)return;m=s.endContainer.firstChild.nextSibling}if(g=m.length,i(m,g),o(m,g),s.endOffset<5)return;l=s.endOffset,u=m}else{if(u=s.endContainer,3!=u.nodeType&&u.firstChild){for(;3!=u.nodeType&&u.firstChild;)u=u.firstChild;3==u.nodeType&&(i(u,0),o(u,u.nodeValue.length))}l=1==s.endOffset?2:s.endOffset-1-t}c=l;do i(u,l>=2?l-2:0),o(u,l>=1?l-1:0),l-=1,h=s.toString();while(" "!=h&&""!==h&&160!=h.charCodeAt(0)&&l-2>=0&&h!=n);s.toString()==n||160==s.toString().charCodeAt(0)?(i(u,l),o(u,c),l+=1):0===s.startOffset?(i(u,0),o(u,c)):(i(u,l),o(u,c)),f=s.toString(),"."==f.charAt(f.length-1)&&o(u,c-1),f=s.toString(),p=f.match(a),p&&("www."==p[1]?p[1]="http://www.":/@$/.test(p[1])&&!/^mailto:/.test(p[1])&&(p[1]="mailto:"+p[1]),d=e.selection.getBookmark(),e.selection.setRng(s),e.execCommand("createlink",!1,p[1]+p[2]),e.settings.default_link_target&&e.dom.setAttrib(e.selection.getNode(),"target",e.settings.default_link_target),e.selection.moveToBookmark(d),e.nodeChanged())}}var o,a=/^(https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.|(?:mailto:)?[A-Z0-9._%+\-]+@)(.+)$/i;return e.settings.autolink_pattern&&(a=e.settings.autolink_pattern),e.on("keydown",function(t){if(13==t.keyCode)return r(e)}),tinymce.Env.ie?void e.on("focus",function(){if(!o){o=!0;try{e.execCommand("AutoUrlDetect",!1,!0)}catch(e){}}}):(e.on("keypress",function(n){if(41==n.keyCode)return t(e)}),void e.on("keyup",function(t){if(32==t.keyCode)return n(e)}))});

View File

@@ -0,0 +1,7 @@
// Exports the "autoresize" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/autoresize')
// ES2015:
// import 'tinymce/plugins/autoresize'
require('./plugin.js');

View 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);
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("autoresize",function(e){function t(){return e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()}function n(r){var a,s,l,c,u,d,f,p,m,g,h,v,b=tinymce.DOM;if(s=e.getDoc()){if(l=s.body,c=s.documentElement,u=i.autoresize_min_height,!l||r&&"setcontent"===r.type&&r.initial||t())return void(l&&c&&(l.style.overflowY="auto",c.style.overflowY="auto"));f=e.dom.getStyle(l,"margin-top",!0),p=e.dom.getStyle(l,"margin-bottom",!0),m=e.dom.getStyle(l,"padding-top",!0),g=e.dom.getStyle(l,"padding-bottom",!0),h=e.dom.getStyle(l,"border-top-width",!0),v=e.dom.getStyle(l,"border-bottom-width",!0),d=l.offsetHeight+parseInt(f,10)+parseInt(p,10)+parseInt(m,10)+parseInt(g,10)+parseInt(h,10)+parseInt(v,10),(isNaN(d)||d<=0)&&(d=tinymce.Env.ie?l.scrollHeight:tinymce.Env.webkit&&0===l.clientHeight?0:l.offsetHeight),d>i.autoresize_min_height&&(u=d),i.autoresize_max_height&&d>i.autoresize_max_height?(u=i.autoresize_max_height,l.style.overflowY="auto",c.style.overflowY="auto"):(l.style.overflowY="hidden",c.style.overflowY="hidden",l.scrollTop=0),u!==o&&(a=u-o,b.setStyle(e.iframeElement,"height",u+"px"),o=u,tinymce.isWebKit&&a<0&&n(r))}}function r(t,i,o){tinymce.util.Delay.setEditorTimeout(e,function(){n({}),t--?r(t,i,o):o&&o()},i)}var i=e.settings,o=0;e.settings.inline||(i.autoresize_min_height=parseInt(e.getParam("autoresize_min_height",e.getElement().offsetHeight),10),i.autoresize_max_height=parseInt(e.getParam("autoresize_max_height",0),10),e.on("init",function(){var t,n;t=e.getParam("autoresize_overflow_padding",1),n=e.getParam("autoresize_bottom_margin",50),t!==!1&&e.dom.setStyles(e.getBody(),{paddingLeft:t,paddingRight:t}),n!==!1&&e.dom.setStyles(e.getBody(),{paddingBottom:n})}),e.on("nodechange setcontent keyup FullscreenStateChanged",n),e.getParam("autoresize_on_init",!0)&&e.on("init",function(){r(20,100,function(){r(5,1e3)})}),e.addCommand("mceAutoResize",n))});

View File

@@ -0,0 +1,7 @@
// Exports the "autosave" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/autosave')
// ES2015:
// import 'tinymce/plugins/autosave'
require('./plugin.js');

View 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|&nbsp;|[ \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;
});

View File

@@ -0,0 +1 @@
tinymce._beforeUnloadHandler=function(){var e;return tinymce.each(tinymce.editors,function(t){t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&t.getParam("autosave_ask_before_unload",!0)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))}),e},tinymce.PluginManager.add("autosave",function(e){function t(e,t){var n={s:1e3,m:6e4};return e=/^(\d+)([ms]?)$/.exec(""+(e||t)),(e[2]?n[e[2]]:1)*parseInt(e,10)}function n(){var e=parseInt(p.getItem(u+"time"),10)||0;return!((new Date).getTime()-e>f.autosave_retention)||(r(!1),!1)}function r(t){p.removeItem(u+"draft"),p.removeItem(u+"time"),t!==!1&&e.fire("RemoveDraft")}function i(){!c()&&e.isDirty()&&(p.setItem(u+"draft",e.getContent({format:"raw",no_events:!0})),p.setItem(u+"time",(new Date).getTime()),e.fire("StoreDraft"))}function o(){n()&&(e.setContent(p.getItem(u+"draft"),{format:"raw"}),e.fire("RestoreDraft"))}function a(){d||(setInterval(function(){e.removed||i()},f.autosave_interval),d=!0)}function s(){var t=this;t.disabled(!n()),e.on("StoreDraft RestoreDraft RemoveDraft",function(){t.disabled(!n())}),a()}function l(){e.undoManager.beforeChange(),o(),r(),e.undoManager.add()}function c(t){var n=e.settings.forced_root_block;return t=tinymce.trim("undefined"==typeof t?e.getBody().innerHTML:t),""===t||new RegExp("^<"+n+"[^>]*>((\xa0|&nbsp;|[ \t]|<br[^>]*>)+?|)</"+n+">|<br>$","i").test(t)}var u,d,f=e.settings,p=tinymce.util.LocalStorage;u=f.autosave_prefix||"tinymce-autosave-{path}{query}-{id}-",u=u.replace(/\{path\}/g,document.location.pathname),u=u.replace(/\{query\}/g,document.location.search),u=u.replace(/\{id\}/g,e.id),f.autosave_interval=t(f.autosave_interval,"30s"),f.autosave_retention=t(f.autosave_retention,"20m"),e.addButton("restoredraft",{title:"Restore last draft",onclick:l,onPostRender:s}),e.addMenuItem("restoredraft",{text:"Restore last draft",onclick:l,onPostRender:s,context:"file"}),e.settings.autosave_restore_when_empty!==!1&&(e.on("init",function(){n()&&c()&&o()}),e.on("saveContent",function(){r()})),window.onbeforeunload=tinymce._beforeUnloadHandler,this.hasDraft=n,this.storeDraft=i,this.restoreDraft=o,this.removeDraft=r,this.isEmpty=c});

View File

@@ -0,0 +1,7 @@
// Exports the "bbcode" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/bbcode')
// ES2015:
// import 'tinymce/plugins/bbcode'
require('./plugin.js');

View 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(/&nbsp;|\u00a0/gi, " ");
rep(/&quot;/gi, "\"");
rep(/&lt;/gi, "<");
rep(/&gt;/gi, ">");
rep(/&amp;/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>&nbsp;");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi, "<span class=\"quoteStyle\">$1</span>&nbsp;");
return s;
}
});
// Register plugin
tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
})();

View File

@@ -0,0 +1 @@
!function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(e){var t=this,n=e.getParam("bbcode_dialect","punbb").toLowerCase();e.on("beforeSetContent",function(e){e.content=t["_"+n+"_bbcode2html"](e.content)}),e.on("postProcess",function(e){e.set&&(e.content=t["_"+n+"_bbcode2html"](e.content)),e.get&&(e.content=t["_"+n+"_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"}},_punbb_html2bbcode:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]"),t(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]"),t(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]"),t(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]"),t(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]"),t(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]"),t(/<font>(.*?)<\/font>/gi,"$1"),t(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"),t(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]"),t(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]"),t(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]"),t(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]"),t(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]"),t(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]"),t(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]"),t(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]"),t(/<\/(strong|b)>/gi,"[/b]"),t(/<(strong|b)>/gi,"[b]"),t(/<\/(em|i)>/gi,"[/i]"),t(/<(em|i)>/gi,"[i]"),t(/<\/u>/gi,"[/u]"),t(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]"),t(/<u>/gi,"[u]"),t(/<blockquote[^>]*>/gi,"[quote]"),t(/<\/blockquote>/gi,"[/quote]"),t(/<br \/>/gi,"\n"),t(/<br\/>/gi,"\n"),t(/<br>/gi,"\n"),t(/<p>/gi,""),t(/<\/p>/gi,"\n"),t(/&nbsp;|\u00a0/gi," "),t(/&quot;/gi,'"'),t(/&lt;/gi,"<"),t(/&gt;/gi,">"),t(/&amp;/gi,"&"),e},_punbb_bbcode2html:function(e){function t(t,n){e=e.replace(t,n)}return e=tinymce.trim(e),t(/\n/gi,"<br />"),t(/\[b\]/gi,"<strong>"),t(/\[\/b\]/gi,"</strong>"),t(/\[i\]/gi,"<em>"),t(/\[\/i\]/gi,"</em>"),t(/\[u\]/gi,"<u>"),t(/\[\/u\]/gi,"</u>"),t(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>'),t(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>'),t(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />'),t(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>'),t(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span>&nbsp;'),t(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span>&nbsp;'),e}}),tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)}();

View File

@@ -0,0 +1,7 @@
// Exports the "charmap" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/charmap')
// ES2015:
// import 'tinymce/plugins/charmap'
require('./plugin.js');

View File

@@ -0,0 +1,466 @@
/**
* 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];
var chrText = chr ? String.fromCharCode(parseInt(chr[0], 10)) : '&nbsp;';
gridHtml += (
'<td title="' + chr[1] + '"><div tabindex="-1" title="' + chr[1] + '" role="button" data-chr="' + chrText + '">' +
chrText +
'</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(target.getAttribute('data-chr'));
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
};
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
// Exports the "code" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/code')
// ES2015:
// import 'tinymce/plugins/code'
require('./plugin.js');

View 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
});
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("code",function(e){function t(){var t=e.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:e.getParam("code_dialog_width",600),minHeight:e.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(t){e.focus(),e.undoManager.transact(function(){e.setContent(t.data.code)}),e.selection.setCursorLocation(),e.nodeChanged()}});t.find("#code").value(e.getContent({source_view:!0}))}e.addCommand("mceCodeEditor",t),e.addButton("code",{icon:"code",tooltip:"Source code",onclick:t}),e.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:t})});

View File

@@ -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;
}

View File

@@ -0,0 +1,7 @@
// Exports the "codesample" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/codesample')
// ES2015:
// import 'tinymce/plugins/codesample'
require('./plugin.js');

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
// Exports the "colorpicker" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/colorpicker')
// ES2015:
// import 'tinymce/plugins/colorpicker'
require('./plugin.js');

View 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;
}
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("colorpicker",function(e){function t(t,n){function r(e){var t=new tinymce.util.Color(e),n=t.toRgb();o.fromJSON({r:n.r,g:n.g,b:n.b,hex:t.toHex().substr(1)}),i(t.toHex())}function i(e){o.find("#preview")[0].getEl().style.background=e}var o=e.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:n,onchange:function(){var e=this.rgb();o&&(o.find("#r").value(e.r),o.find("#g").value(e.g),o.find("#b").value(e.b),o.find("#hex").value(this.value().substr(1)),i(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var e,t,n=o.find("colorpicker")[0];return e=this.name(),t=this.value(),"hex"==e?(t="#"+t,r(t),void n.value(t)):(t={r:o.find("#r").value(),g:o.find("#g").value(),b:o.find("#b").value()},n.value(t),void r(t))}},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(){t("#"+this.toJSON().hex)}});r(n)}e.settings.color_picker_callback||(e.settings.color_picker_callback=t)});

View File

@@ -0,0 +1,7 @@
// Exports the "contextmenu" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/contextmenu')
// ES2015:
// import 'tinymce/plugins/contextmenu'
require('./plugin.js');

View File

@@ -0,0 +1,116 @@
/**
* 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, visibleState, contextmenuNeverUseNative = editor.settings.contextmenu_never_use_native;
var isNativeOverrideKeyEvent = function (e) {
return e.ctrlKey && !contextmenuNeverUseNative;
};
var isMacWebKit = function () {
return tinymce.Env.mac && tinymce.Env.webkit;
};
var isContextMenuVisible = function () {
return visibleState === true;
};
/**
* This takes care of a os x native issue where it expands the selection
* to the word at the caret position to do "lookups". Since we are overriding
* the context menu we also need to override this expanding so the behavior becomes
* normalized. Firefox on os x doesn't expand to the word when using the context menu.
*/
editor.on('mousedown', function (e) {
if (isMacWebKit() && e.button === 2 && !isNativeOverrideKeyEvent(e)) {
if (editor.selection.isCollapsed()) {
editor.once('contextmenu', function (e) {
editor.selection.placeCaretAt(e.clientX, e.clientY);
});
}
}
});
editor.on('contextmenu', function(e) {
var contextmenu;
if (isNativeOverrideKeyEvent(e)) {
return;
}
e.preventDefault();
contextmenu = editor.settings.contextmenu || 'link openlink 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();
menu.on('hide', function (e) {
if (e.control === this) {
visibleState = false;
}
});
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);
visibleState = true;
});
return {
isContextMenuVisible: isContextMenuVisible
};
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("contextmenu",function(e){var t,n,r=e.settings.contextmenu_never_use_native,i=function(e){return e.ctrlKey&&!r},o=function(){return tinymce.Env.mac&&tinymce.Env.webkit},a=function(){return n===!0};return e.on("mousedown",function(t){o()&&2===t.button&&!i(t)&&e.selection.isCollapsed()&&e.once("contextmenu",function(t){e.selection.placeCaretAt(t.clientX,t.clientY)})}),e.on("contextmenu",function(r){var o;if(!i(r)){if(r.preventDefault(),o=e.settings.contextmenu||"link openlink image inserttable | cell row column deletetable",t)t.show();else{var a=[];tinymce.each(o.split(/[ ,]/),function(t){var n=e.menuItems[t];"|"==t&&(n={text:t}),n&&(n.shortcut="",a.push(n))});for(var s=0;s<a.length;s++)"|"==a[s].text&&(0!==s&&s!=a.length-1||a.splice(s,1));t=new tinymce.ui.Menu({items:a,context:"contextmenu",classes:"contextmenu"}).renderTo(),t.on("hide",function(e){e.control===this&&(n=!1)}),e.on("remove",function(){t.remove(),t=null})}var l={x:r.pageX,y:r.pageY};e.inline||(l=tinymce.DOM.getPos(e.getContentAreaContainer()),l.x+=r.clientX,l.y+=r.clientY),t.moveTo(l.x,l.y),n=!0}}),{isContextMenuVisible:a}});

View File

@@ -0,0 +1,7 @@
// Exports the "directionality" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/directionality')
// ES2015:
// import 'tinymce/plugins/directionality'
require('./plugin.js');

View File

@@ -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')
});
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("directionality",function(e){function t(t){var n,r=e.dom,i=e.selection.getSelectedBlocks();i.length&&(n=r.getAttrib(i[0],"dir"),tinymce.each(i,function(e){r.getParent(e.parentNode,"*[dir='"+t+"']",r.getRoot())||(n!=t?r.setAttrib(e,"dir",t):r.setAttrib(e,"dir",null))}),e.nodeChanged())}function n(e){var t=[];return tinymce.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(n){t.push(n+"[dir="+e+"]")}),t.join(",")}e.addCommand("mceDirectionLTR",function(){t("ltr")}),e.addCommand("mceDirectionRTL",function(){t("rtl")}),e.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:n("ltr")}),e.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:n("rtl")})});

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

View File

@@ -0,0 +1,7 @@
// Exports the "emoticons" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/emoticons')
// ES2015:
// import 'tinymce/plugins/emoticons'
require('./plugin.js');

View 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'
});
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("emoticons",function(e,t){function n(){var e;return e='<table role="list" class="mce-grid">',tinymce.each(r,function(n){e+="<tr>",tinymce.each(n,function(n){var r=t+"/img/smiley-"+n+".gif";e+='<td><a href="#" data-mce-url="'+r+'" data-mce-alt="'+n+'" tabindex="-1" role="option" aria-label="'+n+'"><img src="'+r+'" style="width: 18px; height: 18px" role="presentation" /></a></td>'}),e+="</tr>"}),e+="</table>"}var r=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];e.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:n,onclick:function(t){var n=e.dom.getParent(t.target,"a");n&&(e.insertContent('<img src="'+n.getAttribute("data-mce-url")+'" alt="'+n.getAttribute("data-mce-alt")+'" />'),this.hide())}},tooltip:"Emoticons"})});

View File

@@ -0,0 +1,7 @@
// Exports the "fullpage" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/fullpage')
// ES2015:
// import 'tinymce/plugins/fullpage'
require('./plugin.js');

View File

@@ -0,0 +1,493 @@
/**
* 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 (!href) {
return true;
}
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);
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
// Exports the "fullscreen" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/fullscreen')
// ES2015:
// import 'tinymce/plugins/fullscreen'
require('./plugin.js');

View 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+Shift+F',
onClick: toggleFullscreen,
onPostRender: function() {
var self = this;
editor.on('FullscreenStateChanged', function(e) {
self.active(e.state);
});
}
});
return {
isFullscreen: function() {
return fullscreenState;
}
};
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("fullscreen",function(e){function t(){var e,t,n=window,r=document,i=r.body;return i.offsetWidth&&(e=i.offsetWidth,t=i.offsetHeight),n.innerWidth&&n.innerHeight&&(e=n.innerWidth,t=n.innerHeight),{w:e,h:t}}function n(){var e=tinymce.DOM.getViewPort();return{x:e.x,y:e.y}}function r(e){scrollTo(e.x,e.y)}function i(){function i(){f.setStyle(g,"height",t().h-(m.clientHeight-g.clientHeight))}var p,m,g,h,v=document.body,b=document.documentElement;d=!d,m=e.getContainer(),p=m.style,g=e.getContentAreaContainer().firstChild,h=g.style,d?(u=n(),o=h.width,a=h.height,h.width=h.height="100%",l=p.width,c=p.height,p.width=p.height="",f.addClass(v,"mce-fullscreen"),f.addClass(b,"mce-fullscreen"),f.addClass(m,"mce-fullscreen"),f.bind(window,"resize",i),i(),s=i):(h.width=o,h.height=a,l&&(p.width=l),c&&(p.height=c),f.removeClass(v,"mce-fullscreen"),f.removeClass(b,"mce-fullscreen"),f.removeClass(m,"mce-fullscreen"),f.unbind(window,"resize",s),r(u)),e.fire("FullscreenStateChanged",{state:d})}var o,a,s,l,c,u,d=!1,f=tinymce.DOM;if(!e.settings.inline)return e.on("init",function(){e.addShortcut("Ctrl+Shift+F","",i)}),e.on("remove",function(){s&&f.unbind(window,"resize",s)}),e.addCommand("mceFullScreen",i),e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onClick:function(){i(),e.focus()},onPostRender:function(){var t=this;e.on("FullscreenStateChanged",function(e){t.active(e.state)})},context:"view"}),e.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Shift+F",onClick:i,onPostRender:function(){var t=this;e.on("FullscreenStateChanged",function(e){t.active(e.state)})}}),{isFullscreen:function(){return d}}});

View File

@@ -0,0 +1,7 @@
// Exports the "hr" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/hr')
// ES2015:
// import 'tinymce/plugins/hr'
require('./plugin.js');

View 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'
});
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("hr",function(e){e.addCommand("InsertHorizontalRule",function(){e.execCommand("mceInsertContent",!1,"<hr />")}),e.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),e.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})});

View File

@@ -0,0 +1,7 @@
// Exports the "image" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/image')
// ES2015:
// import 'tinymce/plugins/image'
require('./plugin.js');

View File

@@ -0,0 +1,635 @@
/**
* 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);
}
});
}
}
function onBeforeCall(e) {
e.meta = win.toJSON();
}
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,
onbeforecall: onBeforeCall
},
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: 'Image',
onclick: createImageList(showDialog),
context: 'insert',
prependToContext: true
});
editor.addCommand('mceImage', createImageList(showDialog));
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
// Exports the "imagetools" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/imagetools')
// ES2015:
// import 'tinymce/plugins/imagetools'
require('./plugin.js');

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
// Exports the "importcss" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/importcss')
// ES2015:
// import 'tinymce/plugins/importcss'
require('./plugin.js');

View File

@@ -0,0 +1,273 @@
/**
* 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);
});
} finally {
// Ignore
}
return selectors;
}
function defaultConvertSelectorToFormat(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;
}
function getGroupsBySelector(groups, selector) {
return tinymce.util.Tools.grep(groups, function (group) {
return !group.filter || group.filter(selector);
});
}
function compileUserDefinedGroups(groups) {
return tinymce.util.Tools.map(groups, function(group) {
return tinymce.util.Tools.extend({}, group, {
original: group,
selectors: {},
filter: compileFilter(group.filter),
item: {
text: group.title,
menu: []
}
});
});
}
function isExclusiveMode(editor, group) {
// Exclusive mode can only be disabled when there are groups allowing the same style to be present in multiple groups
return group === null || editor.settings.importcss_exclusive !== false;
}
function isUniqueSelector(selector, group, globallyUniqueSelectors) {
return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);
}
function markUniqueSelector(selector, group, globallyUniqueSelectors) {
if (isExclusiveMode(editor, group)) {
globallyUniqueSelectors[selector] = true;
} else {
group.selectors[selector] = true;
}
}
function convertSelectorToFormat(plugin, selector, group) {
var selectorConverter, settings = editor.settings;
if (group && group.selector_converter) {
selectorConverter = group.selector_converter;
} else if (settings.importcss_selector_converter) {
selectorConverter = settings.importcss_selector_converter;
} else {
selectorConverter = defaultConvertSelectorToFormat;
}
return selectorConverter.call(plugin, selector, group);
}
editor.on('renderFormatsMenu', function(e) {
var settings = editor.settings, globallyUniqueSelectors = {};
var selectorFilter = compileFilter(settings.importcss_selector_filter), ctrl = e.control;
var groups = compileUserDefinedGroups(settings.importcss_groups);
var processSelector = function (selector, group) {
if (isUniqueSelector(selector, group, globallyUniqueSelectors)) {
markUniqueSelector(selector, group, globallyUniqueSelectors);
var format = convertSelectorToFormat(self, selector, group);
if (format) {
var formatName = format.name || tinymce.DOM.uniqueId();
editor.formatter.register(formatName, format);
return tinymce.extend({}, ctrl.settings.itemDefaults, {
text: format.title,
format: formatName
});
}
}
return null;
};
if (!editor.settings.importcss_append) {
ctrl.items().remove();
}
each(getSelectors(e.doc || editor.getDoc(), compileFilter(settings.importcss_file_filter)), function(selector) {
if (selector.indexOf('.mce-') === -1) {
if (!selectorFilter || selectorFilter(selector)) {
var selectorGroups = getGroupsBySelector(groups, selector);
if (selectorGroups.length > 0) {
tinymce.util.Tools.each(selectorGroups, function (group) {
var menuItem = processSelector(selector, group);
if (menuItem) {
group.item.menu.push(menuItem);
}
});
} else {
var menuItem = processSelector(selector, null);
if (menuItem) {
ctrl.add(menuItem);
}
}
}
}
});
each(groups, function(group) {
if (group.item.menu.length > 0) {
ctrl.add(group.item);
}
});
e.control.renderNew();
});
// Expose default convertSelectorToFormat implementation
self.convertSelectorToFormat = defaultConvertSelectorToFormat;
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("importcss",function(e){function t(e){var t=tinymce.Env.cacheSuffix;return"string"==typeof e&&(e=e.replace("?"+t,"").replace("&"+t,"")),e}function n(t){var n=e.settings,r=n.skin!==!1&&(n.skin||"lightgray");if(r){var i=n.skin_url;return i=i?e.documentBaseURI.toAbsolute(i):tinymce.baseURL+"/skins/"+r,t===i+"/content"+(e.inline?".inline":"")+".min.css"}return!1}function r(e){return"string"==typeof e?function(t){return t.indexOf(e)!==-1}:e instanceof RegExp?function(t){return e.test(t)}:e}function i(r,i){function o(e,r){var s,l=e.href;if(l=t(l),l&&i(l,r)&&!n(l)){p(e.imports,function(e){o(e,!0)});try{s=e.cssRules||e.rules}catch(e){}p(s,function(e){e.styleSheet?o(e.styleSheet,!0):e.selectorText&&p(e.selectorText.split(","),function(e){a.push(tinymce.trim(e))})})}}var a=[],s={};p(e.contentCSS,function(e){s[e]=!0}),i||(i=function(e,t){return t||s[e]});try{p(r.styleSheets,function(e){o(e)})}finally{}return a}function o(t){var n,r=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(t);if(r){var i=r[1],o=r[2].substr(1).split(".").join(" "),a=tinymce.makeMap("a,img");return r[1]?(n={title:t},e.schema.getTextBlockElements()[i]?n.block=i:e.schema.getBlockElements()[i]||a[i.toLowerCase()]?n.selector=i:n.inline=i):r[2]&&(n={inline:"span",title:t.substr(1),classes:o}),e.settings.importcss_merge_classes!==!1?n.classes=o:n.attributes={"class":o},n}}function a(e,t){return tinymce.util.Tools.grep(e,function(e){return!e.filter||e.filter(t)})}function s(e){return tinymce.util.Tools.map(e,function(e){return tinymce.util.Tools.extend({},e,{original:e,selectors:{},filter:r(e.filter),item:{text:e.title,menu:[]}})})}function l(e,t){return null===t||e.settings.importcss_exclusive!==!1}function c(t,n,r){return!(l(e,n)?t in r:t in n.selectors)}function u(t,n,r){l(e,n)?r[t]=!0:n.selectors[t]=!0}function d(t,n,r){var i,a=e.settings;return i=r&&r.selector_converter?r.selector_converter:a.importcss_selector_converter?a.importcss_selector_converter:o,i.call(t,n,r)}var f=this,p=tinymce.each;e.on("renderFormatsMenu",function(t){var n=e.settings,o={},l=r(n.importcss_selector_filter),m=t.control,g=s(n.importcss_groups),h=function(t,n){if(c(t,n,o)){u(t,n,o);var r=d(f,t,n);if(r){var i=r.name||tinymce.DOM.uniqueId();return e.formatter.register(i,r),tinymce.extend({},m.settings.itemDefaults,{text:r.title,format:i})}}return null};e.settings.importcss_append||m.items().remove(),p(i(t.doc||e.getDoc(),r(n.importcss_file_filter)),function(e){if(e.indexOf(".mce-")===-1&&(!l||l(e))){var t=a(g,e);if(t.length>0)tinymce.util.Tools.each(t,function(t){var n=h(e,t);n&&t.item.menu.push(n)});else{var n=h(e,null);n&&m.add(n)}}}),p(g,function(e){e.item.menu.length>0&&m.add(e.item)}),t.control.renderNew()}),f.convertSelectorToFormat=o});

View File

@@ -0,0 +1,7 @@
// Exports the "insertdatetime" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/insertdatetime')
// ES2015:
// import 'tinymce/plugins/insertdatetime'
require('./plugin.js');

View File

@@ -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: 'Date/time',
menu: menuItems,
context: 'insert'
});
});

View File

@@ -0,0 +1 @@
tinymce.PluginManager.add("insertdatetime",function(e){function t(t,n){function r(e,t){if(e=""+e,e.length<t)for(var n=0;n<t-e.length;n++)e="0"+e;return e}return n=n||new Date,t=t.replace("%D","%m/%d/%Y"),t=t.replace("%r","%I:%M:%S %p"),t=t.replace("%Y",""+n.getFullYear()),t=t.replace("%y",""+n.getYear()),t=t.replace("%m",r(n.getMonth()+1,2)),t=t.replace("%d",r(n.getDate(),2)),t=t.replace("%H",""+r(n.getHours(),2)),t=t.replace("%M",""+r(n.getMinutes(),2)),t=t.replace("%S",""+r(n.getSeconds(),2)),t=t.replace("%I",""+((n.getHours()+11)%12+1)),t=t.replace("%p",""+(n.getHours()<12?"AM":"PM")),t=t.replace("%B",""+e.translate(l[n.getMonth()])),t=t.replace("%b",""+e.translate(s[n.getMonth()])),t=t.replace("%A",""+e.translate(a[n.getDay()])),t=t.replace("%a",""+e.translate(o[n.getDay()])),t=t.replace("%%","%")}function n(n){var r=t(n);if(e.settings.insertdatetime_element){var i;i=t(/%[HMSIp]/.test(n)?"%Y-%m-%dT%H:%M":"%Y-%m-%d"),r='<time datetime="'+i+'">'+r+"</time>";var o=e.dom.getParent(e.selection.getStart(),"time");if(o)return void e.dom.setOuterHTML(o,r)}e.insertContent(r)}var r,i,o="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),a="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),s="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),l="January February March April May June July August September October November December".split(" "),c=[];e.addCommand("mceInsertDate",function(){n(e.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d")))}),e.addCommand("mceInsertTime",function(){n(e.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S")))}),e.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",onclick:function(){n(r||i)},menu:c}),tinymce.each(e.settings.insertdatetime_formats||["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"],function(e){i||(i=e),c.push({text:t(e),onclick:function(){r=e,n(e)}})}),e.addMenuItem("insertdatetime",{icon:"date",text:"Date/time",menu:c,context:"insert"})});

View File

@@ -0,0 +1,7 @@
// Exports the "legacyoutput" plugin for usage with module loaders
// Usage:
// CommonJS:
// require('tinymce/plugins/legacyoutput')
// ES2015:
// import 'tinymce/plugins/legacyoutput'
require('./plugin.js');

View 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);

View File

@@ -0,0 +1 @@
!function(e){e.PluginManager.add("legacyoutput",function(t,n,r){t.settings.inline_styles=!1,t.on("init",function(){var n="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",r=e.explode(t.settings.font_size_style_values),i=t.schema;t.formatter.register({alignleft:{selector:n,attributes:{align:"left"}},aligncenter:{selector:n,attributes:{align:"center"}},alignright:{selector:n,attributes:{align:"right"}},alignjustify:{selector:n,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(t){return e.inArray(r,t.value)+1}}},forecolor:{inline:"font",attributes:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}}),e.each("b,i,u,strike".split(","),function(e){i.addValidElements(e+"[*]")}),i.getElementRule("font")||i.addValidElements("font[face|size|color|style]"),e.each(n.split(","),function(e){var t=i.getElementRule(e);t&&(t.attributes.align||(t.attributes.align={},t.attributesOrder.push("align")))})}),t.addButton("fontsizeselect",function(){var e=[],n="8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7",r=t.settings.fontsize_formats||n;return t.$.each(r.split(" "),function(t,n){var r=n,i=n,o=n.split("=");o.length>1&&(r=o[0],i=o[1]),e.push({text:r,value:i})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:e,fixedWidth:!0,onPostRender:function(){var e=this;t.on("NodeChange",function(){var n;n=t.dom.getParent(t.selection.getNode(),"font"),n?e.value(n.size):e.value("")})},onclick:function(e){e.control.settings.value&&t.execCommand("FontSize",!1,e.control.settings.value)}}}),t.addButton("fontselect",function(){function e(e){e=e.replace(/;$/,"").split(";");for(var t=e.length;t--;)e[t]=e[t].split("=");return e}var n="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",i=[],o=e(t.settings.font_formats||n);return r.each(o,function(e,t){i.push({text:{raw:t[0]},value:t[1],textStyle:t[1].indexOf("dings")==-1?"font-family:"+t[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:i,fixedWidth:!0,onPostRender:function(){var e=this;t.on("NodeChange",function(){var n;n=t.dom.getParent(t.selection.getNode(),"font"),n?e.value(n.face):e.value("")})},onselect:function(e){e.control.settings.value&&t.execCommand("FontName",!1,e.control.settings.value)}}})})}(tinymce);

Some files were not shown because too many files have changed in this diff Show More