From cc6556371473349b8370c27897ef442921c1519f Mon Sep 17 00:00:00 2001 From: Jeroen Akkerman Date: Mon, 6 Apr 2020 14:07:24 +0200 Subject: [PATCH] Fixed typescript error when entering certain strings for toolbar buttons Closes #178 --- CHANGELOG.md | 6 +++++- types/easymde-test.ts | 17 ++++++++++++++++- types/easymde.d.ts | 11 +++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb8312d..da89756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,10 @@ All notable changes to easymde will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - +## [Unreleased] +### Fixed +- Typescript error when entering certain strings for toolbar buttons ([#178]). + ## [2.10.0] - 2020-04-02 ### Added - `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser (Thanks to [@firm1], [#143]). @@ -141,6 +144,7 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown - Cursor not always showing in "text" mode over the edit field +[#178]: https://github.com/Ionaru/easy-markdown-editor/issues/178 [#126]: https://github.com/Ionaru/easy-markdown-editor/issues/126 [#99]: https://github.com/Ionaru/easy-markdown-editor/issues/99 [#45]: https://github.com/Ionaru/easy-markdown-editor/issues/45 diff --git a/types/easymde-test.ts b/types/easymde-test.ts index 7c1c4c7..9ba9898 100644 --- a/types/easymde-test.ts +++ b/types/easymde-test.ts @@ -163,7 +163,7 @@ const editorImagesCustom = new EasyMDE({ syncSideBySidePreviewScroll: true }); -const editorAutosave = new EasyMDE({ +new EasyMDE({ autosave: { enabled: true, delay: 2000, @@ -178,3 +178,18 @@ const editorAutosave = new EasyMDE({ text: 'Stored: ', } }); + +new EasyMDE({ + toolbar: [ + 'bold', + 'italic', + 'heading', + '|', + 'quote', + 'unordered-list', + 'ordered-list', + 'table', + '|', + 'link' + ] +}); diff --git a/types/easymde.d.ts b/types/easymde.d.ts index d77e5f8..55f26ae 100644 --- a/types/easymde.d.ts +++ b/types/easymde.d.ts @@ -27,7 +27,14 @@ interface ArrayOneOrMore extends Array { } type ToolbarButton = - 'strikethrough' + 'bold' + | 'italic' + | 'quote' + | 'unordered-list' + | 'ordered-list' + | 'link' + | 'image' + | 'strikethrough' | 'code' | 'table' | 'redo' @@ -172,7 +179,7 @@ declare namespace EasyMDE { promptURLs?: boolean; renderingConfig?: RenderingOptions; shortcuts?: Shortcuts; - showIcons?: ReadonlyArray; + showIcons?: ReadonlyArray; spellChecker?: boolean; inputStyle?: 'textarea' | 'contenteditable'; nativeSpellcheck?: boolean;