Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Single TinyMCE Instance #123

Merged
merged 1 commit into from
Feb 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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