mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
Merge 336ccab333dba5e92b411d993b6388a89850e17e into 6065d3e08971ec854da6672e0b0082821877c2f6
This commit is contained in:
commit
108349b4d0
@ -212,9 +212,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
margin-bottom: -30px;
|
margin-bottom: -30px;
|
||||||
/* Hack to make IE7 behave */
|
|
||||||
*zoom:1;
|
|
||||||
*display:inline;
|
|
||||||
}
|
}
|
||||||
.CodeMirror-gutter-wrapper {
|
.CodeMirror-gutter-wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -333,9 +330,6 @@ div.CodeMirror-dragcursors {
|
|||||||
background: rgba(255, 255, 0, .4);
|
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 */
|
/* Used to force a border model for a node */
|
||||||
.cm-force-border { padding-right: .1px; }
|
.cm-force-border { padding-right: .1px; }
|
||||||
|
|
||||||
|
17324
debug/simplemde.debug.js
17324
debug/simplemde.debug.js
File diff suppressed because one or more lines are too long
17322
debug/simplemde.js
17322
debug/simplemde.js
File diff suppressed because it is too large
Load Diff
2
dist/simplemde.min.css
vendored
2
dist/simplemde.min.css
vendored
File diff suppressed because one or more lines are too long
18
dist/simplemde.min.js
vendored
18
dist/simplemde.min.js
vendored
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) {
|
function _cleanBlock(cm) {
|
||||||
if(/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
|
if(/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
|
||||||
return;
|
return;
|
||||||
|
// split the selection in lines
|
||||||
var startPoint = cm.getCursor("start");
|
var selections = cm.getSelection().split("\n");
|
||||||
var endPoint = cm.getCursor("end");
|
var removeTags = function(selection) {
|
||||||
var text;
|
var html = marked(selection);
|
||||||
|
// create a div...
|
||||||
for(var line = startPoint.line; line <= endPoint.line; line++) {
|
var tmp = document.createElement("DIV");
|
||||||
text = cm.getLine(line);
|
// .. with the new generated html code...
|
||||||
text = text.replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/, "");
|
tmp.innerHTML = html;
|
||||||
|
// ... now read the text of the generated code.
|
||||||
cm.replaceRange(text, {
|
// This way the browser does the job of removing the tags.
|
||||||
line: line,
|
var result = selection;
|
||||||
ch: 0
|
if(tmp.textContent) {
|
||||||
}, {
|
result = tmp.textContent;
|
||||||
line: line,
|
} else if(tmp.innerText) {
|
||||||
ch: 99999999999999
|
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.
|
// Merge the properties of one object into another.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user