diff --git a/README.md b/README.md
index d261b50..64a9154 100644
--- a/README.md
+++ b/README.md
@@ -144,7 +144,7 @@ const [editor] = new OverType('#editor', {
value: '# Document\n\nSelect text and use the toolbar!'
});
-// Default toolbar: Bold, Italic, Code | Link | H1, H2, H3 | Lists, Tasks | Quote | View Mode
+// Default toolbar: Bold, Italic, Strikethrough, Code | Link | H1, H2, H3 | Lists, Tasks | Quote | View Mode
```
**Custom Toolbar (v2.0):**
@@ -169,7 +169,7 @@ const [editor] = new OverType('#editor', {
]
});
-// Available: bold, italic, code, link, h1, h2, h3, bulletList,
+// Available: bold, italic, strikethrough, code, link, h1, h2, h3, h4, h5, h6, bulletList,
// orderedList, taskList, quote, separator, viewMode
```
@@ -203,7 +203,7 @@ document.querySelector('#bold-btn').addEventListener('click', () => {
});
```
-Available actions include `toggleBold`, `toggleItalic`, `toggleCode`, `insertLink`, `toggleBulletList`, `toggleNumberedList`, `toggleQuote`, `toggleTaskList`, `insertHeader`, `toggleH1`/`H2`/`H3`, `getActiveFormats`, `hasFormat`, `expandSelection`, and `applyCustomFormat`. The same namespace is available as `window.markdownActions` and `OverType.markdownActions` in script-tag builds.
+Available actions include `toggleBold`, `toggleItalic`, `toggleStrikethrough`, `toggleCode`, `insertLink`, `toggleBulletList`, `toggleNumberedList`, `toggleQuote`, `toggleTaskList`, `insertHeader`, `toggleH1`/`H2`/`H3`/`H4`/`H5`/`H6`, `getActiveFormats`, `hasFormat`, `expandSelection`, and `applyCustomFormat`. The same namespace is available as `window.markdownActions` and `OverType.markdownActions` in script-tag builds.
See [examples/custom-toolbar.html](examples/custom-toolbar.html) for complete examples.
@@ -345,6 +345,9 @@ const [editor] = new OverType('#editor', {
h1: '#f95738',
h2: '#ee964b',
h3: '#3d8a51',
+ h4: '#0d3b66',
+ h5: '#5a7a9b',
+ h6: '#999999',
strong: '#ee964b',
em: '#f95738',
link: '#0d3b66',
@@ -697,7 +700,7 @@ When no text is selected, Tab and Shift+Tab use normal browser focus navigation.
## Supported Markdown
-- **Headers** - `# H1`, `## H2`, `### H3`
+- **Headers** - `# H1` through `###### H6`
- **Bold** - `**text**` or `__text__`
- **Italic** - `*text*` or `_text_`
- **Strikethrough** - `~~text~~` or `~text~` (GFM)
diff --git a/scripts/generate-types.js b/scripts/generate-types.js
index c97f55f..198043e 100755
--- a/scripts/generate-types.js
+++ b/scripts/generate-types.js
@@ -337,6 +337,7 @@ export default OverType;
export const markdownActions: {
toggleBold(textarea: HTMLTextAreaElement): void;
toggleItalic(textarea: HTMLTextAreaElement): void;
+ toggleStrikethrough(textarea: HTMLTextAreaElement): void;
toggleCode(textarea: HTMLTextAreaElement): void;
insertLink(textarea: HTMLTextAreaElement, options?: { url?: string; text?: string }): void;
toggleBulletList(textarea: HTMLTextAreaElement): void;
@@ -347,6 +348,9 @@ export const markdownActions: {
toggleH1(textarea: HTMLTextAreaElement): void;
toggleH2(textarea: HTMLTextAreaElement): void;
toggleH3(textarea: HTMLTextAreaElement): void;
+ toggleH4(textarea: HTMLTextAreaElement): void;
+ toggleH5(textarea: HTMLTextAreaElement): void;
+ toggleH6(textarea: HTMLTextAreaElement): void;
getActiveFormats(textarea: HTMLTextAreaElement): string[];
hasFormat(textarea: HTMLTextAreaElement, format: string): boolean;
expandSelection(textarea: HTMLTextAreaElement, options?: object): void;
@@ -359,12 +363,16 @@ export const markdownActions: {
export const toolbarButtons: {
bold: ToolbarButton;
italic: ToolbarButton;
+ strikethrough: ToolbarButton;
code: ToolbarButton;
separator: ToolbarButton;
link: ToolbarButton;
h1: ToolbarButton;
h2: ToolbarButton;
h3: ToolbarButton;
+ h4: ToolbarButton;
+ h5: ToolbarButton;
+ h6: ToolbarButton;
bulletList: ToolbarButton;
orderedList: ToolbarButton;
taskList: ToolbarButton;
diff --git a/src/icons.js b/src/icons.js
index 240cbc9..31ab4d5 100644
--- a/src/icons.js
+++ b/src/icons.js
@@ -14,6 +14,12 @@ export const italicIcon = ``;
+export const strikethroughIcon = ``;
+
export const h1Icon = ``;
@@ -26,6 +32,18 @@ export const h3Icon = ``;
+export const h4Icon = ``;
+
+export const h5Icon = ``;
+
+export const h6Icon = ``;
+
export const linkIcon = `
' },
{ input: '## Subtitle', expected: '## Subtitle
' },
{ input: '### Section', expected: '### Section
' },
- { input: '#### Too Deep', expected: '#### Too Deep
' }
+ { input: '#### Detail', expected: '#### Detail
' },
+ { input: '##### Fine Print', expected: '##### Fine Print
' },
+ { input: '###### Caption', expected: '###### Caption
' },
+ { input: '####### Too Deep', expected: '####### Too Deep
' }
];
tests.forEach(test => {
diff --git a/test/test-types.ts b/test/test-types.ts
index 91eaca3..de85383 100644
--- a/test/test-types.ts
+++ b/test/test-types.ts
@@ -1,6 +1,13 @@
// Test file to verify TypeScript definitions work correctly
// Run: npx tsc --noEmit test-types.ts
-import OverType, { Theme, Options, Stats, OverType as OverTypeInstance } from '../src/overtype';
+import OverType, {
+ Theme,
+ Options,
+ Stats,
+ OverType as OverTypeInstance,
+ markdownActions,
+ toolbarButtons
+} from '../src/overtype';
// Test basic initialization - constructor returns array
const editors1: OverTypeInstance[] = new OverType('#editor');
@@ -93,6 +100,9 @@ const customTheme: Theme = {
h1: '#000000',
h2: '#111111',
h3: '#222222',
+ h4: '#333333',
+ h5: '#444444',
+ h6: '#555555',
strong: '#444444',
em: '#555555',
link: '#0066cc',
@@ -114,6 +124,21 @@ const customTheme: Theme = {
};
OverType.setTheme(customTheme);
+// Test formatting additions exposed from markdown-actions and toolbar buttons
+const formattingTextarea = document.createElement('textarea');
+markdownActions.toggleStrikethrough(formattingTextarea);
+markdownActions.toggleH4(formattingTextarea);
+markdownActions.toggleH5(formattingTextarea);
+markdownActions.toggleH6(formattingTextarea);
+
+const formattingButtons = [
+ toolbarButtons.strikethrough,
+ toolbarButtons.h4,
+ toolbarButtons.h5,
+ toolbarButtons.h6
+];
+formattingButtons.forEach(button => console.log(button.name));
+
// Test accessing built-in themes
const solarTheme: Theme = OverType.themes.solar;
const caveTheme: Theme = OverType.themes.cave;