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