cm-md-editor 3.0.3 → 3.0.5

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 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-md-editor",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
4
4
  "description": "a simple markdown editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/MdEditor.js CHANGED
@@ -99,6 +99,10 @@ export class MdEditor {
99
99
  const button = document.createElement('button')
100
100
  button.type = 'button'
101
101
  button.title = btn.title
102
+ if (btn.name) {
103
+ button.dataset.name = btn.name
104
+ button.classList.add('mde-btn-' + btn.name)
105
+ }
102
106
  button.style.cssText = 'background:none;border:none;border-radius:3px;cursor:pointer;padding:4px 6px;display:flex;align-items:center;justify-content:center;color:inherit;opacity:0.6;transition:opacity 0.15s,background 0.15s;'
103
107
  if (btn.icon) {
104
108
  button.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16" fill="currentColor">${btn.icon}</svg>`
@@ -165,8 +169,7 @@ export class MdEditor {
165
169
  syncStyles()
166
170
 
167
171
  // Move textarea bg to backdrop, make textarea transparent so backdrop shows through
168
- const originalBg = cs.getPropertyValue('background-color')
169
- this.backdrop.style.background = originalBg
172
+ this.backdrop.style.background = cs.getPropertyValue('background-color')
170
173
  this.element.style.overscrollBehavior = 'none'
171
174
  this.element.style.background = 'transparent'
172
175
  this.element.style.position = 'relative'