mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-06-01 21:42:28 +02:00
add onDrawImage
This commit is contained in:
parent
6abda7ab68
commit
b75251f1b7
|
@ -94,8 +94,14 @@
|
|||
|
||||
.cm-tab { display: inline-block; text-decoration: inherit; }
|
||||
|
||||
.CodeMirror-rulers {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: -50px; bottom: -20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
top: 0; bottom: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
@ -206,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;
|
||||
|
@ -226,11 +229,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
||||
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
||||
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
|
@ -252,8 +252,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|||
position: relative;
|
||||
overflow: visible;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-font-variant-ligatures: none;
|
||||
font-variant-ligatures: none;
|
||||
-webkit-font-variant-ligatures: contextual;
|
||||
font-variant-ligatures: contextual;
|
||||
}
|
||||
.CodeMirror-wrap pre {
|
||||
word-wrap: break-word;
|
||||
|
@ -275,6 +275,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|||
|
||||
.CodeMirror-widget {}
|
||||
|
||||
.CodeMirror-rtl pre { direction: rtl; }
|
||||
|
||||
.CodeMirror-code {
|
||||
outline: none;
|
||||
}
|
||||
|
@ -297,7 +299,10 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|||
visibility: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-cursor { position: absolute; }
|
||||
.CodeMirror-cursor {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.CodeMirror-measure pre { position: static; }
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
|
@ -324,9 +329,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; }
|
||||
|
||||
|
|
26541
debug/simplemde.debug.js
26541
debug/simplemde.debug.js
File diff suppressed because one or more lines are too long
26538
debug/simplemde.js
26538
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
|
@ -630,17 +630,22 @@ function drawLink(editor) {
|
|||
/**
|
||||
* Action for drawing an img.
|
||||
*/
|
||||
function drawImage(editor) {
|
||||
function drawImage(editor, imageUrl) {
|
||||
var cm = editor.codemirror;
|
||||
var stat = getState(cm);
|
||||
var options = editor.options;
|
||||
var url = "http://";
|
||||
if(options.onDrawImage && !imageUrl) {
|
||||
options.onDrawImage();
|
||||
return;
|
||||
}
|
||||
if(options.promptURLs) {
|
||||
url = prompt(options.promptTexts.image);
|
||||
if(!url) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
url = imageUrl || url;
|
||||
_replaceSelection(cm, stat.image, options.insertTexts.image, url);
|
||||
}
|
||||
|
||||
|
@ -1947,8 +1952,8 @@ SimpleMDE.prototype.cleanBlock = function() {
|
|||
SimpleMDE.prototype.drawLink = function() {
|
||||
drawLink(this);
|
||||
};
|
||||
SimpleMDE.prototype.drawImage = function() {
|
||||
drawImage(this);
|
||||
SimpleMDE.prototype.drawImage = function(url) {
|
||||
drawImage(this, url);
|
||||
};
|
||||
SimpleMDE.prototype.drawTable = function() {
|
||||
drawTable(this);
|
||||
|
|
Loading…
Reference in a new issue