cm-md-editor 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/MdEditor.js +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-md-editor",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "a simple markdown editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/MdEditor.js CHANGED
@@ -122,7 +122,10 @@ export class MdEditor {
122
122
  }
123
123
 
124
124
  loadIcon(filename) {
125
- return this.loadIconFromUrl(new URL(filename, this.props.iconsPath).href)
125
+ const base = this.props.iconsPath.startsWith('http')
126
+ ? this.props.iconsPath
127
+ : new URL(this.props.iconsPath, window.location.href).href
128
+ return this.loadIconFromUrl(new URL(filename, base).href)
126
129
  }
127
130
 
128
131
  loadIconFromUrl(url) {
@@ -437,6 +440,7 @@ export class MdEditor {
437
440
 
438
441
  insertTextAtCursor(text) {
439
442
  // execCommand is deprecated, but without alternative to insert text and preserve the correct undo/redo stack
443
+ this.element.focus()
440
444
  document.execCommand("insertText", false, text)
441
445
  }
442
446