view src/minified/plugins/alternative-lists.js @ 0:4c4fc447baea

start with sceditor-3.1.1
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 04 Aug 2022 15:21:29 -0600
parents
children
line wrap: on
line source

/* SCEditor v3.1.1 | (C) 2017, Sam Clarke | sceditor.com/license */

!function(n){"use strict";var e=n.utils;n.plugins["alternative-lists"]=function(){var l,i,s;this.init=function(){var t=this.opts;t.format&&"bbcode"!==t.format||(n.command.get("orderedlist").txtExec=i,n.command.get("bulletlist").txtExec=l,n.formats.bbcode.set("list",{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:function(t,l,i){var s="disc",e=null;return"function"==typeof(e=("1"===(s=l.defaultattr?l.defaultattr:s)?n.formats.bbcode.get("ol"):n.formats.bbcode.get("ul")).html)?e.call(this,t,l,i):(t.attrs[0]=i,n.formats.bbcode.formatBBCodeString(e,t.attrs))}}),n.formats.bbcode.set("ul",{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[list]{0}[/list]",html:"<ul>{0}</ul>"}),n.formats.bbcode.set("ol",{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[list=1]{0}[/list]",html:"<ol>{0}</ol>"}),n.formats.bbcode.set("li",{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[*]{0}",html:"<li>{0}</li>"}),n.formats.bbcode.set("*",{isInline:!1,excludeClosing:!0,closedBy:["/ul","/ol","/list","*","li"],html:"<li>{0}</li>"}))},s=function(t,l,i){var s="";e.each(i.split(/\r?\n/),function(t){s+=(s?"\n":"")+"[*]"+t}),""===l?t.insertText("[list]\n"+s+"\n[/list]"):t.insertText("[list="+l+"]\n"+s+"\n[/list]")},i=function(t,l){s(this,"1",l)},l=function(t,l){s(this,"",l)}}}(sceditor);