Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganized directories and cleaned up most of the code
- Loading branch information
Boye
committed
Aug 16, 2013
1 parent
a22f581
commit 7892a88
Showing
21 changed files
with
20,351 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Emmet for TinyMCE</title> | ||
<link rel="stylesheet" href="css/codemirror.min.css"> | ||
</head> | ||
<body> | ||
<form> | ||
<textarea id="code" name="code" autofocus></textarea> | ||
</form> | ||
<script src="js/cm3/codemirror.js"></script> | ||
<script src="js/cm3/xml.js"></script> | ||
<script src="js/emmet/emmet-full.min.js"></script> | ||
<script src="js/emmet/editor.js"></script> | ||
<script src="js/formatting.js"></script> | ||
<script> | ||
var target = document.getElementById('code'), | ||
editor = window.parent.tinymce.activeEditor, | ||
cm; | ||
|
||
target.value = editor.getContent({format : 'raw'}); | ||
|
||
cm = CodeMirror.fromTextArea(target, { | ||
mode : 'text/html', | ||
lineNumbers : true, | ||
indentWithTabs: true, | ||
autofocus: true | ||
}); | ||
|
||
CodeMirror.commands['selectAll'](cm); | ||
|
||
function getSelectedRange() { | ||
return { from: cm.getCursor(true), to: cm.getCursor(false) }; | ||
} | ||
|
||
function autoFormatSelection() { | ||
var range = getSelectedRange(); | ||
cm.autoFormatRange(range.from, range.to); | ||
} | ||
|
||
function commentSelection(isComment) { | ||
var range = getSelectedRange(); | ||
cm.commentRange(isComment, range.from, range.to); | ||
} | ||
|
||
autoFormatSelection(); | ||
|
||
// Save content | ||
cm.on('change', function (cm) { | ||
editor.setContent( cm.getTextArea().value ); | ||
editor.nodeChanged(); | ||
cm.save(); | ||
}); | ||
|
||
// For some reason calling setContent onchange is not enough | ||
// with this listener we make sure that every rule of code will be send back to tinycme | ||
cm.on('blur', function (cm) { | ||
editor.setContent( cm.getTextArea().value ); | ||
editor.nodeChanged(); | ||
cm.save(); | ||
}); | ||
</script> | ||
</body> | ||
<head> | ||
<title>TinyMCE Emmet Plugin</title> | ||
<link rel="stylesheet" href="css/codemirror.min.css"> | ||
</head> | ||
<body> | ||
<form> | ||
<textarea id="code" name="code" autofocus></textarea> | ||
</form> | ||
<script src="js/codemirror/codemirror.min.js"></script> | ||
<script src="js/emmet/emmet-full.min.js"></script> | ||
<script src="js/emmet/emmet-extras.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.