@mdaemon/html-editor 1.6.1 → 1.7.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
@@ -56,6 +56,26 @@ editor.on('dirty', (isDirty) => {
56
56
  editor.destroy();
57
57
  ```
58
58
 
59
+ ### Browser (CDN / script tag)
60
+
61
+ For static pages without a bundler, load the self-contained UMD bundle via a `<script>` tag.
62
+ It exposes the entire public API under the `MDHTMLEditor` global. Styles must be loaded
63
+ separately — the UMD bundle contains JavaScript only.
64
+
65
+ ```html
66
+ <link rel="stylesheet" href="https://unpkg.com/@mdaemon/html-editor/dist/styles.css">
67
+ <script src="https://unpkg.com/@mdaemon/html-editor"></script>
68
+ <script>
69
+ const editor = new MDHTMLEditor.HTMLEditor(
70
+ document.getElementById('editor'),
71
+ { height: 400 }
72
+ );
73
+ </script>
74
+ ```
75
+
76
+ `unpkg` and `jsdelivr` both serve the package; pin a version for production
77
+ (e.g. `https://unpkg.com/@mdaemon/html-editor@1.7.0`).
78
+
59
79
  ### Custom Toolbar Buttons
60
80
 
61
81
  ```typescript
@@ -721,6 +741,36 @@ The editor DOM uses BEM-style classes you can target for further customization:
721
741
  - Safari (latest)
722
742
  - Edge (latest)
723
743
 
744
+ ## Development
745
+
746
+ Clone the repo and install dependencies with `npm install`, then use:
747
+
748
+ ```bash
749
+ npm run build # production build → dist/ (ES, CJS, UMD, .d.ts, styles.css)
750
+ npm run build:dev # development build (unminified, sourcemaps)
751
+ npm run dev # rebuild on change (watch mode)
752
+ npm test # run the Jest suite
753
+ npm run test:dist # build, then smoke-test the built UMD bundle
754
+ npm run typecheck # tsc --noEmit (strict)
755
+ npm run lint # eslint src
756
+ ```
757
+
758
+ ### Demos
759
+
760
+ ```bash
761
+ npm run demo # live demo from TypeScript source (Vite dev server, HTTPS)
762
+ npm run demo:umd # build, then serve the UMD/script-tag demo as static files
763
+ ```
764
+
765
+ - **`npm run demo`** serves `test/index.html` through Vite's dev server, importing the editor
766
+ directly from `src/`. Use this for day-to-day feature work — it hot-reloads and exercises the
767
+ full toolbar. It runs over HTTPS (self-signed cert) so microphone-dependent features
768
+ (Speech-to-Text, Dictation) work.
769
+ - **`npm run demo:umd`** runs a production build and then serves `test/umd.html` as raw static
770
+ files (via `test/serve-umd.mjs`), loading the built `dist/index.umd.js` and `dist/styles.css`
771
+ exactly the way a CDN / `<script>`-tag consumer would. Use this to verify the UMD bundle and
772
+ the `MDHTMLEditor` global.
773
+
724
774
  ## License
725
775
 
726
776
  LGPL 3.0 or later - MDaemon Technologies
package/dist/index.d.ts CHANGED
@@ -848,15 +848,15 @@ export { }
848
848
 
849
849
  declare module '@tiptap/core' {
850
850
  interface Commands<ReturnType> {
851
- lineHeight: {
851
+ fontSize: {
852
852
  /**
853
- * Set the line height
853
+ * Set the font size
854
854
  */
855
- setLineHeight: (lineHeight: string) => ReturnType;
855
+ setFontSize: (size: string) => ReturnType;
856
856
  /**
857
- * Unset the line height
857
+ * Unset the font size
858
858
  */
859
- unsetLineHeight: () => ReturnType;
859
+ unsetFontSize: () => ReturnType;
860
860
  };
861
861
  }
862
862
  }
@@ -864,15 +864,11 @@ declare module '@tiptap/core' {
864
864
 
865
865
  declare module '@tiptap/core' {
866
866
  interface Commands<ReturnType> {
867
- textDirection: {
868
- /**
869
- * Set the text direction
870
- */
871
- setTextDirection: (direction: 'ltr' | 'rtl' | 'auto') => ReturnType;
872
- /**
873
- * Unset the text direction
874
- */
875
- unsetTextDirection: () => ReturnType;
867
+ inlineStyle: {
868
+ /** Apply a CSS class to the current selection via the textStyle mark. */
869
+ setInlineClass: (className: string) => ReturnType;
870
+ /** Remove the textStyle class. */
871
+ unsetInlineClass: () => ReturnType;
876
872
  };
877
873
  }
878
874
  }
@@ -880,11 +876,9 @@ declare module '@tiptap/core' {
880
876
 
881
877
  declare module '@tiptap/core' {
882
878
  interface Commands<ReturnType> {
883
- inlineStyle: {
884
- /** Apply a CSS class to the current selection via the textStyle mark. */
885
- setInlineClass: (className: string) => ReturnType;
886
- /** Remove the textStyle class. */
887
- unsetInlineClass: () => ReturnType;
879
+ anchor: {
880
+ /** Insert a named anchor at the cursor. */
881
+ setAnchor: (name: string) => ReturnType;
888
882
  };
889
883
  }
890
884
  }
@@ -892,15 +886,15 @@ declare module '@tiptap/core' {
892
886
 
893
887
  declare module '@tiptap/core' {
894
888
  interface Commands<ReturnType> {
895
- fontSize: {
889
+ textDirection: {
896
890
  /**
897
- * Set the font size
891
+ * Set the text direction
898
892
  */
899
- setFontSize: (size: string) => ReturnType;
893
+ setTextDirection: (direction: 'ltr' | 'rtl' | 'auto') => ReturnType;
900
894
  /**
901
- * Unset the font size
895
+ * Unset the text direction
902
896
  */
903
- unsetFontSize: () => ReturnType;
897
+ unsetTextDirection: () => ReturnType;
904
898
  };
905
899
  }
906
900
  }
@@ -908,9 +902,15 @@ declare module '@tiptap/core' {
908
902
 
909
903
  declare module '@tiptap/core' {
910
904
  interface Commands<ReturnType> {
911
- anchor: {
912
- /** Insert a named anchor at the cursor. */
913
- setAnchor: (name: string) => ReturnType;
905
+ lineHeight: {
906
+ /**
907
+ * Set the line height
908
+ */
909
+ setLineHeight: (lineHeight: string) => ReturnType;
910
+ /**
911
+ * Unset the line height
912
+ */
913
+ unsetLineHeight: () => ReturnType;
914
914
  };
915
915
  }
916
916
  }