pull/464/merge
Thiago Veronezi 8 years ago committed by GitHub
commit 108349b4d0

@ -212,9 +212,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
/* Hack to make IE7 behave */
*zoom:1;
*display:inline;
}
.CodeMirror-gutter-wrapper {
position: absolute;
@ -333,9 +330,6 @@ div.CodeMirror-dragcursors {
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; }

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

@ -1015,23 +1015,32 @@ function _toggleBlock(editor, type, start_chars, end_chars) {
function _cleanBlock(cm) {
if(/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
return;
var startPoint = cm.getCursor("start");
var endPoint = cm.getCursor("end");
var text;
for(var line = startPoint.line; line <= endPoint.line; line++) {
text = cm.getLine(line);
text = text.replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/, "");
cm.replaceRange(text, {
line: line,
ch: 0
}, {
line: line,
ch: 99999999999999
});
// split the selection in lines
var selections = cm.getSelection().split("\n");
var removeTags = function(selection) {
var html = marked(selection);
// create a div...
var tmp = document.createElement("DIV");
// .. with the new generated html code...
tmp.innerHTML = html;
// ... now read the text of the generated code.
// This way the browser does the job of removing the tags.
var result = selection;
if(tmp.textContent) {
result = tmp.textContent;
} else if(tmp.innerText) {
result = tmp.innerText;
}
// removing trailing "new line"
return result.split("\n").join("");
};
var result = [];
for(var i = 0; i < selections.length; i++) {
result.push(removeTags(selections[i]));
}
// Add removed "new lines" back to the resulting string.
// Replace the selection with the new clean selection.
cm.replaceSelection(result.join("\n"));
}
// Merge the properties of one object into another.

Loading…
Cancel
Save