annotate public/javascripts/jstoolbar/textile.js @ 1452:d6b9fd02bb89 feature_36_js_refactoring

Deprecated develoment branch.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 11 Oct 2013 17:01:24 +0100
parents 513646585e45
children 622f24f53b42
rev   line source
Chris@0 1 /* ***** BEGIN LICENSE BLOCK *****
Chris@0 2 * This file is part of DotClear.
Chris@0 3 * Copyright (c) 2005 Nicolas Martin & Olivier Meunier and contributors. All
Chris@0 4 * rights reserved.
Chris@0 5 *
Chris@0 6 * DotClear is free software; you can redistribute it and/or modify
Chris@0 7 * it under the terms of the GNU General Public License as published by
Chris@0 8 * the Free Software Foundation; either version 2 of the License, or
Chris@0 9 * (at your option) any later version.
Chris@0 10 *
Chris@0 11 * DotClear is distributed in the hope that it will be useful,
Chris@0 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@0 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 14 * GNU General Public License for more details.
Chris@0 15 *
Chris@0 16 * You should have received a copy of the GNU General Public License
Chris@0 17 * along with DotClear; if not, write to the Free Software
Chris@0 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Chris@0 19 *
Chris@0 20 * ***** END LICENSE BLOCK *****
Chris@0 21 */
Chris@0 22
Chris@0 23 /* Modified by JP LANG for textile formatting */
Chris@0 24
Chris@0 25 // strong
Chris@0 26 jsToolBar.prototype.elements.strong = {
Chris@0 27 type: 'button',
Chris@0 28 title: 'Strong',
Chris@0 29 fn: {
Chris@0 30 wiki: function() { this.singleTag('*') }
Chris@0 31 }
Chris@0 32 }
Chris@0 33
Chris@0 34 // em
Chris@0 35 jsToolBar.prototype.elements.em = {
Chris@0 36 type: 'button',
Chris@0 37 title: 'Italic',
Chris@0 38 fn: {
Chris@0 39 wiki: function() { this.singleTag("_") }
Chris@0 40 }
Chris@0 41 }
Chris@0 42
Chris@0 43 // ins
Chris@0 44 jsToolBar.prototype.elements.ins = {
Chris@0 45 type: 'button',
Chris@0 46 title: 'Underline',
Chris@0 47 fn: {
Chris@0 48 wiki: function() { this.singleTag('+') }
Chris@0 49 }
Chris@0 50 }
Chris@0 51
Chris@0 52 // del
Chris@0 53 jsToolBar.prototype.elements.del = {
Chris@0 54 type: 'button',
Chris@0 55 title: 'Deleted',
Chris@0 56 fn: {
Chris@0 57 wiki: function() { this.singleTag('-') }
Chris@0 58 }
Chris@0 59 }
Chris@0 60
Chris@0 61 // code
Chris@0 62 jsToolBar.prototype.elements.code = {
Chris@0 63 type: 'button',
Chris@0 64 title: 'Code',
Chris@0 65 fn: {
Chris@0 66 wiki: function() { this.singleTag('@') }
Chris@0 67 }
Chris@0 68 }
Chris@0 69
Chris@0 70 // spacer
Chris@0 71 jsToolBar.prototype.elements.space1 = {type: 'space'}
Chris@0 72
Chris@0 73 // headings
Chris@0 74 jsToolBar.prototype.elements.h1 = {
Chris@0 75 type: 'button',
Chris@0 76 title: 'Heading 1',
Chris@0 77 fn: {
Chris@0 78 wiki: function() {
Chris@0 79 this.encloseLineSelection('h1. ', '',function(str) {
Chris@0 80 str = str.replace(/^h\d+\.\s+/, '')
Chris@0 81 return str;
Chris@0 82 });
Chris@0 83 }
Chris@0 84 }
Chris@0 85 }
Chris@0 86 jsToolBar.prototype.elements.h2 = {
Chris@0 87 type: 'button',
Chris@0 88 title: 'Heading 2',
Chris@0 89 fn: {
Chris@0 90 wiki: function() {
Chris@0 91 this.encloseLineSelection('h2. ', '',function(str) {
Chris@0 92 str = str.replace(/^h\d+\.\s+/, '')
Chris@0 93 return str;
Chris@0 94 });
Chris@0 95 }
Chris@0 96 }
Chris@0 97 }
Chris@0 98 jsToolBar.prototype.elements.h3 = {
Chris@0 99 type: 'button',
Chris@0 100 title: 'Heading 3',
Chris@0 101 fn: {
Chris@0 102 wiki: function() {
Chris@0 103 this.encloseLineSelection('h3. ', '',function(str) {
Chris@0 104 str = str.replace(/^h\d+\.\s+/, '')
Chris@0 105 return str;
Chris@0 106 });
Chris@0 107 }
Chris@0 108 }
Chris@0 109 }
Chris@0 110
Chris@0 111 // spacer
Chris@0 112 jsToolBar.prototype.elements.space2 = {type: 'space'}
Chris@0 113
Chris@0 114 // ul
Chris@0 115 jsToolBar.prototype.elements.ul = {
Chris@0 116 type: 'button',
Chris@0 117 title: 'Unordered list',
Chris@0 118 fn: {
Chris@0 119 wiki: function() {
Chris@0 120 this.encloseLineSelection('','',function(str) {
Chris@0 121 str = str.replace(/\r/g,'');
Chris@0 122 return str.replace(/(\n|^)[#-]?\s*/g,"$1* ");
Chris@0 123 });
Chris@0 124 }
Chris@0 125 }
Chris@0 126 }
Chris@0 127
Chris@0 128 // ol
Chris@0 129 jsToolBar.prototype.elements.ol = {
Chris@0 130 type: 'button',
Chris@0 131 title: 'Ordered list',
Chris@0 132 fn: {
Chris@0 133 wiki: function() {
Chris@0 134 this.encloseLineSelection('','',function(str) {
Chris@0 135 str = str.replace(/\r/g,'');
Chris@0 136 return str.replace(/(\n|^)[*-]?\s*/g,"$1# ");
Chris@0 137 });
Chris@0 138 }
Chris@0 139 }
Chris@0 140 }
Chris@0 141
Chris@0 142 // spacer
Chris@0 143 jsToolBar.prototype.elements.space3 = {type: 'space'}
Chris@0 144
Chris@0 145 // bq
Chris@0 146 jsToolBar.prototype.elements.bq = {
Chris@0 147 type: 'button',
Chris@0 148 title: 'Quote',
Chris@0 149 fn: {
Chris@0 150 wiki: function() {
Chris@0 151 this.encloseLineSelection('','',function(str) {
Chris@0 152 str = str.replace(/\r/g,'');
Chris@0 153 return str.replace(/(\n|^) *([^\n]*)/g,"$1> $2");
Chris@0 154 });
Chris@0 155 }
Chris@0 156 }
Chris@0 157 }
Chris@0 158
Chris@0 159 // unbq
Chris@0 160 jsToolBar.prototype.elements.unbq = {
Chris@0 161 type: 'button',
Chris@0 162 title: 'Unquote',
Chris@0 163 fn: {
Chris@0 164 wiki: function() {
Chris@0 165 this.encloseLineSelection('','',function(str) {
Chris@0 166 str = str.replace(/\r/g,'');
Chris@0 167 return str.replace(/(\n|^) *[>]? *([^\n]*)/g,"$1$2");
Chris@0 168 });
Chris@0 169 }
Chris@0 170 }
Chris@0 171 }
Chris@0 172
Chris@0 173 // pre
Chris@0 174 jsToolBar.prototype.elements.pre = {
Chris@0 175 type: 'button',
Chris@0 176 title: 'Preformatted text',
Chris@0 177 fn: {
Chris@0 178 wiki: function() { this.encloseLineSelection('<pre>\n', '\n</pre>') }
Chris@0 179 }
Chris@0 180 }
Chris@0 181
Chris@0 182 // spacer
Chris@0 183 jsToolBar.prototype.elements.space4 = {type: 'space'}
Chris@0 184
Chris@0 185 // wiki page
Chris@0 186 jsToolBar.prototype.elements.link = {
Chris@0 187 type: 'button',
Chris@0 188 title: 'Wiki link',
Chris@0 189 fn: {
Chris@0 190 wiki: function() { this.encloseSelection("[[", "]]") }
Chris@0 191 }
Chris@0 192 }
Chris@0 193 // image
Chris@0 194 jsToolBar.prototype.elements.img = {
Chris@0 195 type: 'button',
Chris@0 196 title: 'Image',
Chris@0 197 fn: {
Chris@0 198 wiki: function() { this.encloseSelection("!", "!") }
Chris@0 199 }
Chris@0 200 }