Skip to content

Commit

Permalink
Merge Single TinyMCE Instance
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Feb 23, 2017
1 parent b56a86f commit 8b436e4
Show file tree
Hide file tree
Showing 12 changed files with 3,032 additions and 0 deletions.
251 changes: 251 additions & 0 deletions shared/gridicons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions shared/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
body {
background: #f3f6f8;
color: #2f4452;
font-family: Merriweather, Georgia, "Times New Roman", Times, serif;
font-size: 1.25em;
line-height: 1.5;
margin: 1em;
}

a {
color: inherit;
}

nav {
font-size: 16px;
}

nav:target {
display: none;
}

nav li.is-active {
font-weight: bold;
}

#editor {
background: #fff;
margin: 5em auto;
outline: none;
padding: 5em;
width: 37.5em;
}

#editor iframe {
max-width: 100%;
border: 0;
}

#editor img {
max-width: 100%;
height: auto;
}

#editor figure {
margin: 0;
}

#editor figure.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}

#editor figure.alignleft {
float: left;
margin: 0.5em 1em 0.5em 0;
width: 50%;
}

#editor figure.alignright {
float: right;
margin: 0.5em 0 0.5em 1em;
width: 50%;
}

#editor figcaption {
font-size: 0.8em;
margin-top: 0.5em;
}

#editor figure img {
display: block;
}

#editor pre {
overflow: auto;
}

#editor:after {
content: ".";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
19 changes: 19 additions & 0 deletions shared/tinymce/clean-paste.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
( function( tinymce ) {
tinymce.PluginManager.add( 'clean-paste', function( editor ) {
// To do: remove pasted classes but keep when internally pasted.

editor.on( 'BeforePastePreProcess', function( event ) {
var content = event.content;

// Remove all external styles
content = content.replace( /(<[^>]+) style="[^"]*"([^>]*>)/gi, '$1$2' );

// Keep internal styles
content = content.replace( /(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function( all, before, value, after ) {
return before + ' style="' + value + '"' + after;
} );

event.content = content;
} );
} );
} )( window.tinymce );
Loading

0 comments on commit 8b436e4

Please sign in to comment.