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