mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-09-08 00:32:34 -06:00
Fix for issue #386 Show '-' instead of '*' for unordered list
Added unorderedListStyle to the options
This commit is contained in:
parent
59a676bc8a
commit
5df842b630
@ -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"],
|
||||
|
@ -793,7 +793,17 @@ function toggleHeading3(editor) {
|
||||
*/
|
||||
function toggleUnorderedList(editor) {
|
||||
var cm = editor.codemirror;
|
||||
_toggleLine(cm, 'unordered-list');
|
||||
var liststyle = editor.options.unorderedListStyle;
|
||||
|
||||
liststyle = (
|
||||
liststyle != undefined
|
||||
&& liststyle !== ''
|
||||
&& liststyle.length == 1
|
||||
)
|
||||
? liststyle
|
||||
: '*';
|
||||
|
||||
_toggleLine(cm, 'unordered-list', liststyle);
|
||||
}
|
||||
|
||||
|
||||
@ -1171,7 +1181,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;
|
||||
|
||||
@ -1190,7 +1200,7 @@ function _toggleLine(cm, name) {
|
||||
var _getChar = function (name, i) {
|
||||
var map = {
|
||||
'quote': '>',
|
||||
'unordered-list': '*',
|
||||
'unordered-list': liststyle,
|
||||
'ordered-list': '%%i.',
|
||||
};
|
||||
|
||||
@ -1200,7 +1210,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]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user