@mdaemon/html-editor 1.0.10 → 1.0.11

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.
package/dist/index.d.ts CHANGED
@@ -499,6 +499,11 @@ export declare class Toolbar {
499
499
  private createFontSizeDropdown;
500
500
  private createLineHeightDropdown;
501
501
  private createTemplateDropdown;
502
+ /**
503
+ * Position a fixed-position menu below its trigger button.
504
+ * Uses getBoundingClientRect so the menu escapes any overflow:hidden ancestor.
505
+ */
506
+ private positionMenu;
502
507
  private createDropdown;
503
508
  private createColorPicker;
504
509
  private bindEvents;
package/dist/index.js CHANGED
@@ -43141,6 +43141,15 @@ class Toolbar {
43141
43141
  }
43142
43142
  });
43143
43143
  }
43144
+ /**
43145
+ * Position a fixed-position menu below its trigger button.
43146
+ * Uses getBoundingClientRect so the menu escapes any overflow:hidden ancestor.
43147
+ */
43148
+ positionMenu(button, menu) {
43149
+ const rect = button.getBoundingClientRect();
43150
+ menu.style.top = `${rect.bottom}px`;
43151
+ menu.style.left = `${rect.left}px`;
43152
+ }
43144
43153
  createDropdown(name, label, options, onSelect, getCurrentValue) {
43145
43154
  const wrapper = document.createElement("div");
43146
43155
  wrapper.className = "md-toolbar-dropdown";
@@ -43191,6 +43200,9 @@ class Toolbar {
43191
43200
  const isOpen = menu.style.display !== "none";
43192
43201
  menu.style.display = isOpen ? "none" : "block";
43193
43202
  wrapper.classList.toggle("md-toolbar-dropdown-open", !isOpen);
43203
+ if (!isOpen) {
43204
+ this.positionMenu(button, menu);
43205
+ }
43194
43206
  if (!isOpen && getCurrentValue) {
43195
43207
  const currentVal = getCurrentValue();
43196
43208
  menu.querySelectorAll(".md-toolbar-dropdown-item").forEach((item) => {
@@ -43269,6 +43281,9 @@ class Toolbar {
43269
43281
  const isOpen = menu.style.display !== "none";
43270
43282
  menu.style.display = isOpen ? "none" : "block";
43271
43283
  wrapper.classList.toggle("md-toolbar-colorpicker-open", !isOpen);
43284
+ if (!isOpen) {
43285
+ this.positionMenu(button, menu);
43286
+ }
43272
43287
  });
43273
43288
  wrapper.appendChild(button);
43274
43289
  wrapper.appendChild(menu);
package/dist/index.mjs CHANGED
@@ -43139,6 +43139,15 @@ class Toolbar {
43139
43139
  }
43140
43140
  });
43141
43141
  }
43142
+ /**
43143
+ * Position a fixed-position menu below its trigger button.
43144
+ * Uses getBoundingClientRect so the menu escapes any overflow:hidden ancestor.
43145
+ */
43146
+ positionMenu(button, menu) {
43147
+ const rect = button.getBoundingClientRect();
43148
+ menu.style.top = `${rect.bottom}px`;
43149
+ menu.style.left = `${rect.left}px`;
43150
+ }
43142
43151
  createDropdown(name, label, options, onSelect, getCurrentValue) {
43143
43152
  const wrapper = document.createElement("div");
43144
43153
  wrapper.className = "md-toolbar-dropdown";
@@ -43189,6 +43198,9 @@ class Toolbar {
43189
43198
  const isOpen = menu.style.display !== "none";
43190
43199
  menu.style.display = isOpen ? "none" : "block";
43191
43200
  wrapper.classList.toggle("md-toolbar-dropdown-open", !isOpen);
43201
+ if (!isOpen) {
43202
+ this.positionMenu(button, menu);
43203
+ }
43192
43204
  if (!isOpen && getCurrentValue) {
43193
43205
  const currentVal = getCurrentValue();
43194
43206
  menu.querySelectorAll(".md-toolbar-dropdown-item").forEach((item) => {
@@ -43267,6 +43279,9 @@ class Toolbar {
43267
43279
  const isOpen = menu.style.display !== "none";
43268
43280
  menu.style.display = isOpen ? "none" : "block";
43269
43281
  wrapper.classList.toggle("md-toolbar-colorpicker-open", !isOpen);
43282
+ if (!isOpen) {
43283
+ this.positionMenu(button, menu);
43284
+ }
43270
43285
  });
43271
43286
  wrapper.appendChild(button);
43272
43287
  wrapper.appendChild(menu);
package/dist/styles.css CHANGED
@@ -180,9 +180,7 @@
180
180
  }
181
181
 
182
182
  .md-toolbar-dropdown-menu {
183
- position: absolute;
184
- top: 100%;
185
- left: 0;
183
+ position: fixed;
186
184
  min-width: 150px;
187
185
  max-height: 300px;
188
186
  overflow-y: auto;
@@ -193,8 +191,10 @@
193
191
  z-index: 1000;
194
192
  }
195
193
 
196
- .md-toolbar-dropdown-item {
194
+ .md-editor .md-toolbar-dropdown-item {
197
195
  display: block;
196
+ margin-top: 2px;
197
+ margin-bottom: 2px;
198
198
  width: 100%;
199
199
  padding: 8px 12px;
200
200
  border: none;
@@ -204,10 +204,10 @@
204
204
  font-size: 13px;
205
205
  color: #222;
206
206
  }
207
- .md-toolbar-dropdown-item:hover {
207
+ .md-editor .md-toolbar-dropdown-item:hover {
208
208
  background: #f0f0f0;
209
209
  }
210
- .md-toolbar-dropdown-item.md-toolbar-dropdown-item-selected {
210
+ .md-editor .md-toolbar-dropdown-item.md-toolbar-dropdown-item-selected {
211
211
  background: #2271b2;
212
212
  color: #fff;
213
213
  }
@@ -245,15 +245,14 @@
245
245
  }
246
246
 
247
247
  .md-toolbar-colorpicker-menu {
248
- position: absolute;
249
- top: 100%;
250
- left: 0;
248
+ position: fixed;
251
249
  padding: 8px;
252
250
  background: #fff;
253
251
  border: 1px solid #ccc;
254
252
  border-radius: 3px;
255
253
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
256
- z-index: 100;
254
+ z-index: 1000;
255
+ padding: 6px;
257
256
  }
258
257
 
259
258
  .md-toolbar-colorpicker-grid {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdaemon/html-editor",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "A TinyMCE-compatible HTML editor built on TipTap",
5
5
  "homepage": "https://github.com/mdaemon-technologies/MDHTMLEditor",
6
6
  "repository": {