@opositatest/markdown-text-editor 1.1.1-canary.bc9b3d0 → 1.2.0

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/README.md CHANGED
@@ -92,6 +92,7 @@ Load via CDN (no build step required):
92
92
  | `readonly` | boolean | Makes the editor read-only |
93
93
  | `required` | boolean | Participates in native form validation |
94
94
  | `hidden-slash-menu-items` | string | JSON array of item titles to hide from slash menu |
95
+ | `formatting-toolbar` | boolean | Floating formatting toolbar on text selection (default: enabled, set to `false` to disable) |
95
96
 
96
97
  `width` and `height` accept any valid CSS size, such as `320px`, `40rem`, or `100%`.
97
98
 
@@ -135,6 +136,7 @@ Use these exact titles in the `hidden-slash-menu-items` JSON array to hide speci
135
136
  | `element.height` | string | Get or set CSS height |
136
137
  | `element.disabled` | boolean | Get or set disabled state |
137
138
  | `element.readOnly` | boolean | Get or set read-only state |
139
+ | `element.formattingToolbar` | boolean | Get or set the floating formatting toolbar state |
138
140
 
139
141
  ### Methods
140
142
 
@@ -186,6 +188,7 @@ import "@opositatest/markdown-text-editor/style";
186
188
  | `readonly` | `boolean` | Makes the editor read-only |
187
189
  | `className` | `string` | Additional CSS class on the editor container |
188
190
  | `hiddenSlashMenuItems` | `string[]` | Array of item titles to hide from slash menu |
191
+ | `formattingToolbar` | `boolean` | Floating formatting toolbar on text selection (default: `true`) |
189
192
 
190
193
  `width` and `height` accept any valid CSS size, such as `320px`, `40rem`, or `100%`.
191
194
 
package/dist/editor.js CHANGED
@@ -31,7 +31,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
31
31
  "disabled",
32
32
  "readonly",
33
33
  "required",
34
- "hidden-slash-menu-items"
34
+ "hidden-slash-menu-items",
35
+ "formatting-toolbar"
35
36
  ], h = "Please fill out this field.", g = /* @__PURE__ */ s(((e) => {
36
37
  function t(e, t) {
37
38
  var n = e.length;
@@ -64601,12 +64602,12 @@ var T6 = (0, E.forwardRef)((e, t) => {
64601
64602
  D6[2], D6[6], D6[2], D6[6], D6[2], D6[7], D6[2], D6[7], D6[2], D6[8], D6[5], D6[7], D6[8], D6[7], D6[4], O6.borderRadius, O6.fontFamily;
64602
64603
  //#endregion
64603
64604
  //#region src/components/app-block-note-view/app-block-note-view.tsx
64604
- function nhe(e) {
64605
+ function nhe({ formattingToolbar: e = !0, linkToolbar: t = !0, ...n }) {
64605
64606
  return /* @__PURE__ */ (0, D.jsx)(E6, {
64606
- ...e,
64607
+ ...n,
64607
64608
  theme: "light",
64608
- formattingToolbar: !1,
64609
- linkToolbar: !1,
64609
+ formattingToolbar: e,
64610
+ linkToolbar: t,
64610
64611
  slashMenu: !1,
64611
64612
  sideMenu: !1,
64612
64613
  filePanel: !0,
@@ -87102,30 +87103,32 @@ function a_e(e, t) {
87102
87103
  let n = {};
87103
87104
  if (e && (n.width = e), t && (n.height = t, n["--markdown-text-editor-height"] = t), !(!e && !t)) return n;
87104
87105
  }
87105
- var o_e = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled: n = !1, height: r, hiddenSlashMenuItems: i = [], onChange: a, onReady: o, placeholder: s, readonly: c = !1, value: l, width: u }, d) {
87106
- let { editor: f, handleBlockNoteChange: p, handleSuggestionMenuItems: m } = i_e({
87106
+ var o_e = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled: n = !1, formattingToolbar: r = !0, height: i, hiddenSlashMenuItems: a = [], onChange: o, onReady: s, placeholder: c, readonly: l = !1, value: u, width: d }, f) {
87107
+ let { editor: p, handleBlockNoteChange: m, handleSuggestionMenuItems: h } = i_e({
87107
87108
  defaultValue: t,
87108
- hiddenSlashMenuItems: i,
87109
- onChange: a,
87110
- onReady: o,
87111
- placeholder: s,
87112
- ref: d,
87113
- value: l
87114
- }), h = a_e(u, r);
87109
+ hiddenSlashMenuItems: a,
87110
+ onChange: o,
87111
+ onReady: s,
87112
+ placeholder: c,
87113
+ ref: f,
87114
+ value: u
87115
+ }), g = a_e(d, i);
87115
87116
  return /* @__PURE__ */ (0, D.jsx)("div", {
87116
87117
  className: e,
87117
87118
  "data-disabled": n ? "true" : void 0,
87118
- "data-has-custom-height": r ? "true" : void 0,
87119
- "data-readonly": c ? "true" : void 0,
87120
- style: h,
87119
+ "data-has-custom-height": i ? "true" : void 0,
87120
+ "data-readonly": l ? "true" : void 0,
87121
+ style: g,
87121
87122
  children: /* @__PURE__ */ (0, D.jsx)(nhe, {
87122
- editor: f,
87123
+ editor: p,
87123
87124
  className: "markdown-editor-field",
87124
- editable: !n && !c,
87125
- onChange: p,
87125
+ editable: !n && !l,
87126
+ formattingToolbar: r,
87127
+ linkToolbar: r,
87128
+ onChange: m,
87126
87129
  children: /* @__PURE__ */ (0, D.jsx)(Due, {
87127
87130
  triggerCharacter: "/",
87128
- getItems: m
87131
+ getItems: h
87129
87132
  })
87130
87133
  })
87131
87134
  });
@@ -87214,6 +87217,16 @@ var o_e = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled:
87214
87217
  set hiddenSlashMenuItems(e) {
87215
87218
  this._hiddenSlashMenuItems = e, this.renderReact();
87216
87219
  }
87220
+ get formattingToolbar() {
87221
+ return this.getAttribute("formatting-toolbar") !== "false";
87222
+ }
87223
+ set formattingToolbar(e) {
87224
+ if (e) {
87225
+ this.removeAttribute("formatting-toolbar");
87226
+ return;
87227
+ }
87228
+ this.setAttribute("formatting-toolbar", "false");
87229
+ }
87217
87230
  focus() {
87218
87231
  this.editorHandle?.focus();
87219
87232
  }
@@ -87254,6 +87267,7 @@ var o_e = (0, E.forwardRef)(function({ className: e, defaultValue: t, disabled:
87254
87267
  width: this.width,
87255
87268
  className: f,
87256
87269
  hiddenSlashMenuItems: this._hiddenSlashMenuItems,
87270
+ formattingToolbar: this.formattingToolbar,
87257
87271
  onChange: this.handleEditorChange,
87258
87272
  onReady: this.handleEditorReady
87259
87273
  }));
@@ -73736,12 +73736,12 @@ var w6 = l((e, t) => {
73736
73736
  E6[2], E6[6], E6[2], E6[6], E6[2], E6[7], E6[2], E6[7], E6[2], E6[8], E6[5], E6[7], E6[8], E6[7], E6[4], D6.borderRadius, D6.fontFamily;
73737
73737
  //#endregion
73738
73738
  //#region src/components/app-block-note-view/app-block-note-view.tsx
73739
- function npe(e) {
73739
+ function npe({ formattingToolbar: e = !0, linkToolbar: t = !0, ...n }) {
73740
73740
  return /* @__PURE__ */ T(T6, {
73741
- ...e,
73741
+ ...n,
73742
73742
  theme: "light",
73743
- formattingToolbar: !1,
73744
- linkToolbar: !1,
73743
+ formattingToolbar: e,
73744
+ linkToolbar: t,
73745
73745
  slashMenu: !1,
73746
73746
  sideMenu: !1,
73747
73747
  filePanel: !0,
@@ -96237,30 +96237,32 @@ function ohe(e, t) {
96237
96237
  let n = {};
96238
96238
  if (e && (n.width = e), t && (n.height = t, n["--markdown-text-editor-height"] = t), !(!e && !t)) return n;
96239
96239
  }
96240
- var she = l(function({ className: e, defaultValue: t, disabled: n = !1, height: r, hiddenSlashMenuItems: i = [], onChange: a, onReady: o, placeholder: s, readonly: c = !1, value: l, width: u }, d) {
96241
- let { editor: f, handleBlockNoteChange: p, handleSuggestionMenuItems: m } = ahe({
96240
+ var she = l(function({ className: e, defaultValue: t, disabled: n = !1, formattingToolbar: r = !0, height: i, hiddenSlashMenuItems: a = [], onChange: o, onReady: s, placeholder: c, readonly: l = !1, value: u, width: d }, f) {
96241
+ let { editor: p, handleBlockNoteChange: m, handleSuggestionMenuItems: h } = ahe({
96242
96242
  defaultValue: t,
96243
- hiddenSlashMenuItems: i,
96244
- onChange: a,
96245
- onReady: o,
96246
- placeholder: s,
96247
- ref: d,
96248
- value: l
96249
- }), h = ohe(u, r);
96243
+ hiddenSlashMenuItems: a,
96244
+ onChange: o,
96245
+ onReady: s,
96246
+ placeholder: c,
96247
+ ref: f,
96248
+ value: u
96249
+ }), g = ohe(d, i);
96250
96250
  return /* @__PURE__ */ T("div", {
96251
96251
  className: e,
96252
96252
  "data-disabled": n ? "true" : void 0,
96253
- "data-has-custom-height": r ? "true" : void 0,
96254
- "data-readonly": c ? "true" : void 0,
96255
- style: h,
96253
+ "data-has-custom-height": i ? "true" : void 0,
96254
+ "data-readonly": l ? "true" : void 0,
96255
+ style: g,
96256
96256
  children: /* @__PURE__ */ T(npe, {
96257
- editor: f,
96257
+ editor: p,
96258
96258
  className: "markdown-editor-field",
96259
- editable: !n && !c,
96260
- onChange: p,
96259
+ editable: !n && !l,
96260
+ formattingToolbar: r,
96261
+ linkToolbar: r,
96262
+ onChange: m,
96261
96263
  children: /* @__PURE__ */ T(o0, {
96262
96264
  triggerCharacter: "/",
96263
- getItems: m
96265
+ getItems: h
96264
96266
  })
96265
96267
  })
96266
96268
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opositatest/markdown-text-editor",
3
- "version": "1.1.1-canary.bc9b3d0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"