Merge branch 'master' into options-toolbarbutton-attributes

pull/388/head
Jeroen Akkerman 2 years ago
commit 1c656d5712

@ -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] -->
## [Unreleased]
### Added
- `unorderedListStyle` option to change the character used for unordered lists (Thanks to [@Zignature], [#389]).
## [2.16.0] - 2021-10-28
### Added
- `direction` option to enable RTL mode (Thanks to [@souljuse], [#358]).
@ -232,6 +235,7 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
[#9]: https://github.com/Ionaru/easy-markdown-editor/issues/9
<!-- Linked PRs -->
[#389]: https://github.com/Ionaru/easy-markdown-editor/pull/389
[#364]: https://github.com/Ionaru/easy-markdown-editor/pull/364
[#358]: https://github.com/Ionaru/easy-markdown-editor/pull/358
[#357]: https://github.com/Ionaru/easy-markdown-editor/pull/357
@ -329,6 +333,7 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
[@ukjinjang]: https://github.com/ukjinjang
[@robjean9]: https://github.com/robjean9
[@Offerel]: https://github.com/Offerel
[@Zignature]: https://github.com/Zignature
<!-- Linked versions -->
[Unreleased]: https://github.com/Ionaru/easy-markdown-editor/compare/2.16.0...HEAD

@ -136,6 +136,7 @@ easyMDE.value('New input for **EasyMDE**');
- **bold**: Can be set to `**` or `__`. Defaults to `**`.
- **code**: Can be set to ```` ``` ```` or `~~~`. Defaults to ```` ``` ````.
- **italic**: Can be set to `*` or `_`. Defaults to `*`.
- **unorderedListStyle**: can be `*`, `-` or `+`. Defaults to `*`.
- **scrollbarStyle**: Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models.
- **element**: The DOM element for the TextArea to use. Defaults to the first TextArea on the page.
- **forceSync**: If set to `true`, force text changes made in EasyMDE to be immediately stored in original text area. Defaults to `false`.
@ -242,6 +243,7 @@ const editor = new EasyMDE({
bold: "__",
italic: "_",
},
unorderedListStyle: "-",
element: document.getElementById("MyID"),
forceSync: true,
hideIcons: ["guide", "heading"],

@ -188,6 +188,11 @@ function removeClass(el, className) {
function createToolbarDropdown(options, enableTooltips, shortcuts, parent) {
var el = createToolbarButton(options, false, enableTooltips, shortcuts, 'button', parent);
el.className += ' easymde-dropdown';
el.onclick = function () {
el.focus();
};
var content = document.createElement('div');
content.className = 'easymde-dropdown-content';
for (var childrenIndex = 0; childrenIndex < options.children.length; childrenIndex++) {
@ -201,6 +206,7 @@ function createToolbarDropdown(options, enableTooltips, shortcuts, parent) {
childElement = createToolbarButton(child, true, enableTooltips, shortcuts, 'button', parent);
}
childElement.addEventListener('click', function (e) { e.stopPropagation(); }, false);
content.appendChild(childElement);
}
el.appendChild(content);
@ -799,7 +805,13 @@ function toggleHeading3(editor) {
*/
function toggleUnorderedList(editor) {
var cm = editor.codemirror;
_toggleLine(cm, 'unordered-list');
var listStyle = '*'; // Default
if (['-', '+', '*'].includes(editor.options.unorderedListStyle)) {
listStyle = editor.options.unorderedListStyle;
}
_toggleLine(cm, 'unordered-list', listStyle);
}
@ -1177,7 +1189,7 @@ function _toggleHeading(cm, direction, size) {
}
function _toggleLine(cm, name) {
function _toggleLine(cm, name, liststyle) {
if (/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
return;
@ -1196,7 +1208,7 @@ function _toggleLine(cm, name) {
var _getChar = function (name, i) {
var map = {
'quote': '>',
'unordered-list': '*',
'unordered-list': liststyle,
'ordered-list': '%%i.',
};
@ -1206,7 +1218,7 @@ function _toggleLine(cm, name) {
var _checkChar = function (name, char) {
var map = {
'quote': '>',
'unordered-list': '\\*',
'unordered-list': '\\' + liststyle,
'ordered-list': '\\d+.',
};
var rt = new RegExp(map[name]);

@ -38,6 +38,7 @@ const editor2 = new EasyMDE({
autoDownloadFontAwesome: undefined,
previewClass: ['my-custom-class', 'some-other-class'],
nativeSpellcheck: true,
unorderedListStyle: '-',
inputStyle: 'contenteditable',
toolbar: [
{
@ -104,6 +105,7 @@ const editorImages = new EasyMDE({
previewImagesInEditor: false,
imageAccept: 'image/png, image/bmp',
imageCSRFToken: undefined,
unorderedListStyle: '+',
imageMaxSize: 10485760,
imageUploadEndpoint: 'https://my.domain/image-upload/',
imageTexts: {
@ -170,6 +172,7 @@ const editorImagesCustom = new EasyMDE({
new EasyMDE({
sideBySideFullscreen: true,
lineNumbers: false,
unorderedListStyle: '*',
autosave: {
enabled: true,
delay: 2000,

@ -206,6 +206,7 @@ declare namespace EasyMDE {
onToggleFullScreen?: (goingIntoFullScreen: boolean) => void;
theme?: string;
scrollbarStyle?: string;
unorderedListStyle?: '*' | '-' | '+';
uploadImage?: boolean;
imageMaxSize?: number;

Loading…
Cancel
Save