/% |Name|QuickEdit_indent| |Source|http://www.TiddlyTools.com/#QuickEdit_custom| |Version|2.3.0| |Author|Eric Shulman| |License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]| |~CoreVersion|2.2| |Type|script| |Requires|QuickEditPlugin| |Overrides|| |Description|provides a droplist of custom-defined formats| Usage: in QuickEditToolbar: <<tiddler QuickEdit_custom>> OR in EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_custom'></span> !help Reminders: Custom format definitions are stored as an "HR-separated list" in a tiddler named [[QuickEdit_customList]]. The first line of each list item is the text 'label' to show in the droplist, followed by one or more lines of wiki content to be inserted into the tiddler source. To embed the tiddler editor's current selected text within the formatted output, use "$1" (without quotes) to mark the position(s) where the selection should be inserted. !end help %/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" title="custom defined formats" onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform'; var s=createTiddlyElement(p,'select'); s.button=this; s.options[0]=new Option('select a custom format...',''); var items=store.getTiddlerText('QuickEdit_indentList','').split('\n----\n'); for (var i=0; i<items.length; i++) { if (!items[i].length) continue; var lines=items[i].split('\n'); var label=lines.shift(); var val=lines.join('\n'); s.options[s.length]=new Option(label,val); s.options[s.length-1].title=val; } s.options[s.length]=new Option('[Edit custom formats...]','_edit'); s.options[s.length-1].title='add/change custom format definitions...'; s.size=Math.min(s.length,15); s.onclick=function(){ if (!this.value.length) return; if (this.value=='_edit') { alert(store.getTiddlerText('QuickEdit_iframe##help')); story.displayTiddler(story.findContainingTiddler(this.button), 'QuickEdit_indent',DEFAULT_EDIT_TEMPLATE); } else { var e=config.quickEdit.getField(this.button); if (!e) return false; e.focus(); var txt=config.quickEdit.getSelection(e); replaceSelection(e,this.value.replace(/\$\x31/g,txt)); } Popup.remove(); return false; }; s.onkeyup=function(ev){ var k=(ev||window.event).keyCode; if (k==13) this.onclick(); if (k==27) Popup.remove(); }; Popup.show(p,false); s.focus(); return config.quickEdit.processed(event);" >IFrame</a></html>