cm-md-editor 3.0.0 → 3.0.2

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.
@@ -6,7 +6,8 @@
6
6
  "Bash(for f:*)",
7
7
  "Bash(do echo:*)",
8
8
  "Read(//Users/shaack/Development/repositories/MyProjects/cm-md-editor/**)",
9
- "Bash(done)"
9
+ "Bash(done)",
10
+ "Bash(npm whoami:*)"
10
11
  ]
11
12
  }
12
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-md-editor",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "a simple markdown editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/MdEditor.js CHANGED
@@ -23,6 +23,7 @@ export class MdEditor {
23
23
  colorEscape: "128,128,128",
24
24
  colorFrontMatter: "128,128,200",
25
25
  wordWrap: true,
26
+ iconsPath: new URL('./tools/icons/', import.meta.url).href,
26
27
  tools: defaultTools,
27
28
  ...props
28
29
  }
@@ -121,8 +122,10 @@ export class MdEditor {
121
122
  }
122
123
 
123
124
  loadIcon(filename) {
124
- const baseUrl = new URL('./tools/icons/', import.meta.url)
125
- return this.loadIconFromUrl(new URL(filename, baseUrl).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) {