Quellcode durchsuchen

Update markitup editor

richard vor 6 Monaten
Ursprung
Commit
01a250d28a
47 geänderte Dateien mit 1018 neuen und 30 gelöschten Zeilen
  1. 673 0
      admin/scripts/markitup/jquery.markitup.js
  2. 0 27
      admin/scripts/markitup/jquery.markitup.pack.js
  3. 0 0
      admin/scripts/markitup/sets/default/images/bold.png
  4. 0 0
      admin/scripts/markitup/sets/default/images/clean.png
  5. 0 0
      admin/scripts/markitup/sets/default/images/image.png
  6. 0 0
      admin/scripts/markitup/sets/default/images/italic.png
  7. 0 0
      admin/scripts/markitup/sets/default/images/link.png
  8. 0 0
      admin/scripts/markitup/sets/default/images/list-bullet.png
  9. 0 0
      admin/scripts/markitup/sets/default/images/list-numeric.png
  10. 0 0
      admin/scripts/markitup/sets/default/images/picture.png
  11. 0 0
      admin/scripts/markitup/sets/default/images/preview.png
  12. 0 0
      admin/scripts/markitup/sets/default/images/stroke.png
  13. 30 0
      admin/scripts/markitup/sets/default/set.js
  14. 34 0
      admin/scripts/markitup/sets/default/style.css
  15. BIN
      admin/scripts/markitup/sets/html/images/code.png
  16. BIN
      admin/scripts/markitup/sets/html/images/fonts.png
  17. BIN
      admin/scripts/markitup/sets/html/images/h1.png
  18. BIN
      admin/scripts/markitup/sets/html/images/h2.png
  19. BIN
      admin/scripts/markitup/sets/html/images/h3.png
  20. BIN
      admin/scripts/markitup/sets/html/images/h4.png
  21. BIN
      admin/scripts/markitup/sets/html/images/h5.png
  22. BIN
      admin/scripts/markitup/sets/html/images/h6.png
  23. BIN
      admin/scripts/markitup/sets/html/images/list-item.png
  24. BIN
      admin/scripts/markitup/sets/html/images/more.png
  25. BIN
      admin/scripts/markitup/sets/html/images/paragraph.png
  26. BIN
      admin/scripts/markitup/sets/html/images/quotes.png
  27. BIN
      admin/scripts/markitup/sets/html/images/underline.png
  28. BIN
      admin/scripts/markitup/sets/html/images/url.png
  29. 0 1
      admin/scripts/markitup/sets/html/set.js
  30. 0 1
      admin/scripts/markitup/sets/html/style.css
  31. BIN
      admin/scripts/markitup/skins/markitup/images/bg-container.png
  32. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-bbcode.png
  33. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-dotclear.png
  34. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-html.png
  35. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-json.png
  36. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-markdown.png
  37. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-textile.png
  38. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-wiki.png
  39. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor-xml.png
  40. BIN
      admin/scripts/markitup/skins/markitup/images/bg-editor.png
  41. BIN
      admin/scripts/markitup/skins/markitup/images/handle.png
  42. BIN
      admin/scripts/markitup/skins/markitup/images/menu.png
  43. BIN
      admin/scripts/markitup/skins/markitup/images/submenu.png
  44. 147 0
      admin/scripts/markitup/skins/markitup/style.css
  45. 118 1
      admin/scripts/markitup/skins/simple/style.css
  46. 5 0
      admin/scripts/markitup/templates/preview.css
  47. 11 0
      admin/scripts/markitup/templates/preview.html

+ 673 - 0
admin/scripts/markitup/jquery.markitup.js Datei anzeigen

@@ -0,0 +1,673 @@
1
+// ----------------------------------------------------------------------------
2
+// markItUp! Universal MarkUp Engine, JQuery plugin
3
+// v 1.1.x
4
+// Dual licensed under the MIT and GPL licenses.
5
+// ----------------------------------------------------------------------------
6
+// Copyright (C) 2007-2012 Jay Salvat
7
+// http://markitup.jaysalvat.com/
8
+// ----------------------------------------------------------------------------
9
+// Permission is hereby granted, free of charge, to any person obtaining a copy
10
+// of this software and associated documentation files (the "Software"), to deal
11
+// in the Software without restriction, including without limitation the rights
12
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+// copies of the Software, and to permit persons to whom the Software is
14
+// furnished to do so, subject to the following conditions:
15
+// 
16
+// The above copyright notice and this permission notice shall be included in
17
+// all copies or substantial portions of the Software.
18
+// 
19
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+// THE SOFTWARE.
26
+// ----------------------------------------------------------------------------
27
+(function($) {
28
+	$.fn.markItUp = function(settings, extraSettings) {
29
+		var method, params, options, ctrlKey, shiftKey, altKey; ctrlKey = shiftKey = altKey = false;
30
+
31
+		if (typeof settings == 'string') {
32
+			method = settings;
33
+			params = extraSettings;
34
+		} 
35
+
36
+		options = {	id:						'',
37
+					nameSpace:				'',
38
+					root:					'',
39
+					previewHandler:			false,
40
+					previewInWindow:		'', // 'width=800, height=600, resizable=yes, scrollbars=yes'
41
+					previewInElement:		'',
42
+					previewAutoRefresh:		true,
43
+					previewPosition:		'after',
44
+					previewTemplatePath:	'~/templates/preview.html',
45
+					previewParser:			false,
46
+					previewParserPath:		'',
47
+					previewParserVar:		'data',
48
+					previewParserAjaxType:	'POST',
49
+					resizeHandle:			true,
50
+					beforeInsert:			'',
51
+					afterInsert:			'',
52
+					onEnter:				{},
53
+					onShiftEnter:			{},
54
+					onCtrlEnter:			{},
55
+					onTab:					{},
56
+					markupSet:			[	{ /* set */ } ]
57
+				};
58
+		$.extend(options, settings, extraSettings);
59
+
60
+		// compute markItUp! path
61
+		if (!options.root) {
62
+			$('script').each(function(a, tag) {
63
+				var miuScript = $(tag).get(0).src.match(/(.*)jquery\.markitup(\.pack)?\.js$/);
64
+				if (miuScript !== null) {
65
+					options.root = miuScript[1];
66
+				}
67
+			});
68
+		}
69
+
70
+		// Quick patch to keep compatibility with jQuery 1.9
71
+		var uaMatch = function(ua) {
72
+			ua = ua.toLowerCase();
73
+
74
+			var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
75
+				/(webkit)[ \/]([\w.]+)/.exec(ua) ||
76
+				/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
77
+				/(msie) ([\w.]+)/.exec(ua) ||
78
+				ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
79
+				[];
80
+
81
+			return {
82
+				browser: match[ 1 ] || "",
83
+				version: match[ 2 ] || "0"
84
+			};
85
+		};
86
+		var matched = uaMatch( navigator.userAgent );
87
+		var browser = {};
88
+
89
+		if (matched.browser) {
90
+			browser[matched.browser] = true;
91
+			browser.version = matched.version;
92
+		}
93
+		if (browser.chrome) {
94
+			browser.webkit = true;
95
+		} else if (browser.webkit) {
96
+			browser.safari = true;
97
+		}
98
+
99
+		return this.each(function() {
100
+			var $$, textarea, levels, scrollPosition, caretPosition, caretOffset,
101
+				clicked, hash, header, footer, previewWindow, template, iFrame, abort;
102
+			$$ = $(this);
103
+			textarea = this;
104
+			levels = [];
105
+			abort = false;
106
+			scrollPosition = caretPosition = 0;
107
+			caretOffset = -1;
108
+
109
+			options.previewParserPath = localize(options.previewParserPath);
110
+			options.previewTemplatePath = localize(options.previewTemplatePath);
111
+
112
+			if (method) {
113
+				switch(method) {
114
+					case 'remove':
115
+						remove();
116
+					break;
117
+					case 'insert':
118
+						markup(params);
119
+					break;
120
+					default: 
121
+						$.error('Method ' +  method + ' does not exist on jQuery.markItUp');
122
+				}
123
+				return;
124
+			}
125
+
126
+			// apply the computed path to ~/
127
+			function localize(data, inText) {
128
+				if (inText) {
129
+					return 	data.replace(/("|')~\//g, "$1"+options.root);
130
+				}
131
+				return 	data.replace(/^~\//, options.root);
132
+			}
133
+
134
+			// init and build editor
135
+			function init() {
136
+				id = ''; nameSpace = '';
137
+				if (options.id) {
138
+					id = 'id="'+options.id+'"';
139
+				} else if ($$.attr("id")) {
140
+					id = 'id="markItUp'+($$.attr("id").substr(0, 1).toUpperCase())+($$.attr("id").substr(1))+'"';
141
+
142
+				}
143
+				if (options.nameSpace) {
144
+					nameSpace = 'class="'+options.nameSpace+'"';
145
+				}
146
+				$$.wrap('<div '+nameSpace+'></div>');
147
+				$$.wrap('<div '+id+' class="markItUp"></div>');
148
+				$$.wrap('<div class="markItUpContainer"></div>');
149
+				$$.addClass("markItUpEditor");
150
+
151
+				// add the header before the textarea
152
+				header = $('<div class="markItUpHeader"></div>').insertBefore($$);
153
+				$(dropMenus(options.markupSet)).appendTo(header);
154
+
155
+				// add the footer after the textarea
156
+				footer = $('<div class="markItUpFooter"></div>').insertAfter($$);
157
+
158
+				// add the resize handle after textarea
159
+				if (options.resizeHandle === true && browser.safari !== true) {
160
+					resizeHandle = $('<div class="markItUpResizeHandle"></div>')
161
+						.insertAfter($$)
162
+						.bind("mousedown.markItUp", function(e) {
163
+							var h = $$.height(), y = e.clientY, mouseMove, mouseUp;
164
+							mouseMove = function(e) {
165
+								$$.css("height", Math.max(20, e.clientY+h-y)+"px");
166
+								return false;
167
+							};
168
+							mouseUp = function(e) {
169
+								$("html").unbind("mousemove.markItUp", mouseMove).unbind("mouseup.markItUp", mouseUp);
170
+								return false;
171
+							};
172
+							$("html").bind("mousemove.markItUp", mouseMove).bind("mouseup.markItUp", mouseUp);
173
+					});
174
+					footer.append(resizeHandle);
175
+				}
176
+
177
+				// listen key events
178
+				$$.bind('keydown.markItUp', keyPressed).bind('keyup', keyPressed);
179
+				
180
+				// bind an event to catch external calls
181
+				$$.bind("insertion.markItUp", function(e, settings) {
182
+					if (settings.target !== false) {
183
+						get();
184
+					}
185
+					if (textarea === $.markItUp.focused) {
186
+						markup(settings);
187
+					}
188
+				});
189
+
190
+				// remember the last focus
191
+				$$.bind('focus.markItUp', function() {
192
+					$.markItUp.focused = this;
193
+				});
194
+
195
+				if (options.previewInElement) {
196
+					refreshPreview();
197
+				}
198
+			}
199
+
200
+			// recursively build header with dropMenus from markupset
201
+			function dropMenus(markupSet) {
202
+				var ul = $('<ul></ul>'), i = 0;
203
+				$('li:hover > ul', ul).css('display', 'block');
204
+				$.each(markupSet, function() {
205
+					var button = this, t = '', title, li, j;
206
+					button.title ? title = (button.key) ? (button.title||'')+' [Ctrl+'+button.key+']' : (button.title||'') : title = (button.key) ? (button.name||'')+' [Ctrl+'+button.key+']' : (button.name||'');
207
+					key   = (button.key) ? 'accesskey="'+button.key+'"' : '';
208
+					if (button.separator) {
209
+						li = $('<li class="markItUpSeparator">'+(button.separator||'')+'</li>').appendTo(ul);
210
+					} else {
211
+						i++;
212
+						for (j = levels.length -1; j >= 0; j--) {
213
+							t += levels[j]+"-";
214
+						}
215
+						li = $('<li class="markItUpButton markItUpButton'+t+(i)+' '+(button.className||'')+'"><a href="#" '+key+' title="'+title+'">'+(button.name||'')+'</a></li>')
216
+						.bind("contextmenu.markItUp", function() { // prevent contextmenu on mac and allow ctrl+click
217
+							return false;
218
+						}).bind('click.markItUp', function(e) {
219
+							e.preventDefault();
220
+						}).bind("focusin.markItUp", function(){
221
+                            $$.focus();
222
+						}).bind('mouseup', function(e) {
223
+							if (button.call) {
224
+								eval(button.call)(e); // Pass the mouseup event to custom delegate
225
+							}
226
+							setTimeout(function() { markup(button) },1);
227
+							return false;
228
+						}).bind('mouseenter.markItUp', function() {
229
+								$('> ul', this).show();
230
+								$(document).one('click', function() { // close dropmenu if click outside
231
+										$('ul ul', header).hide();
232
+									}
233
+								);
234
+						}).bind('mouseleave.markItUp', function() {
235
+								$('> ul', this).hide();
236
+						}).appendTo(ul);
237
+						if (button.dropMenu) {
238
+							levels.push(i);
239
+							$(li).addClass('markItUpDropMenu').append(dropMenus(button.dropMenu));
240
+						}
241
+					}
242
+				}); 
243
+				levels.pop();
244
+				return ul;
245
+			}
246
+
247
+			// markItUp! markups
248
+			function magicMarkups(string) {
249
+				if (string) {
250
+					string = string.toString();
251
+					string = string.replace(/\(\!\(([\s\S]*?)\)\!\)/g,
252
+						function(x, a) {
253
+							var b = a.split('|!|');
254
+							if (altKey === true) {
255
+								return (b[1] !== undefined) ? b[1] : b[0];
256
+							} else {
257
+								return (b[1] === undefined) ? "" : b[0];
258
+							}
259
+						}
260
+					);
261
+					// [![prompt]!], [![prompt:!:value]!]
262
+					string = string.replace(/\[\!\[([\s\S]*?)\]\!\]/g,
263
+						function(x, a) {
264
+							var b = a.split(':!:');
265
+							if (abort === true) {
266
+								return false;
267
+							}
268
+							value = prompt(b[0], (b[1]) ? b[1] : '');
269
+							if (value === null) {
270
+								abort = true;
271
+							}
272
+							return value;
273
+						}
274
+					);
275
+					return string;
276
+				}
277
+				return "";
278
+			}
279
+
280
+			// prepare action
281
+			function prepare(action) {
282
+				if ($.isFunction(action)) {
283
+					action = action(hash);
284
+				}
285
+				return magicMarkups(action);
286
+			}
287
+
288
+			// build block to insert
289
+			function build(string) {
290
+				var openWith 			= prepare(clicked.openWith);
291
+				var placeHolder 		= prepare(clicked.placeHolder);
292
+				var replaceWith 		= prepare(clicked.replaceWith);
293
+				var closeWith 			= prepare(clicked.closeWith);
294
+				var openBlockWith 		= prepare(clicked.openBlockWith);
295
+				var closeBlockWith 		= prepare(clicked.closeBlockWith);
296
+				var multiline 			= clicked.multiline;
297
+				
298
+				if (replaceWith !== "") {
299
+					block = openWith + replaceWith + closeWith;
300
+				} else if (selection === '' && placeHolder !== '') {
301
+					block = openWith + placeHolder + closeWith;
302
+				} else {
303
+					string = string || selection;
304
+
305
+					var lines = [string], blocks = [];
306
+					
307
+					if (multiline === true) {
308
+						lines = string.split(/\r?\n/);
309
+					}
310
+					
311
+					for (var l = 0; l < lines.length; l++) {
312
+						line = lines[l];
313
+						var trailingSpaces;
314
+						if (trailingSpaces = line.match(/ *$/)) {
315
+							blocks.push(openWith + line.replace(/ *$/g, '') + closeWith + trailingSpaces);
316
+						} else {
317
+							blocks.push(openWith + line + closeWith);
318
+						}
319
+					}
320
+					
321
+					block = blocks.join("\n");
322
+				}
323
+
324
+				block = openBlockWith + block + closeBlockWith;
325
+
326
+				return {	block:block, 
327
+							openBlockWith:openBlockWith,
328
+							openWith:openWith, 
329
+							replaceWith:replaceWith, 
330
+							placeHolder:placeHolder,
331
+							closeWith:closeWith,
332
+							closeBlockWith:closeBlockWith
333
+					};
334
+			}
335
+
336
+			// define markup to insert
337
+			function markup(button) {
338
+				var len, j, n, i;
339
+				hash = clicked = button;
340
+				get();
341
+				$.extend(hash, {	line:"", 
342
+						 			root:options.root,
343
+									textarea:textarea, 
344
+									selection:(selection||''), 
345
+									caretPosition:caretPosition,
346
+									ctrlKey:ctrlKey, 
347
+									shiftKey:shiftKey, 
348
+									altKey:altKey
349
+								}
350
+							);
351
+				// callbacks before insertion
352
+				prepare(options.beforeInsert);
353
+				prepare(clicked.beforeInsert);
354
+				if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
355
+					prepare(clicked.beforeMultiInsert);
356
+				}			
357
+				$.extend(hash, { line:1 });
358
+
359
+				if ((ctrlKey === true && shiftKey === true)) {
360
+					lines = selection.split(/\r?\n/);
361
+					for (j = 0, n = lines.length, i = 0; i < n; i++) {
362
+						if ($.trim(lines[i]) !== '') {
363
+							$.extend(hash, { line:++j, selection:lines[i] } );
364
+							lines[i] = build(lines[i]).block;
365
+						} else {
366
+							lines[i] = "";
367
+						}
368
+					}
369
+
370
+					string = { block:lines.join('\n')};
371
+					start = caretPosition;
372
+					len = string.block.length + ((browser.opera) ? n-1 : 0);
373
+				} else if (ctrlKey === true) {
374
+					string = build(selection);
375
+					start = caretPosition + string.openWith.length;
376
+					len = string.block.length - string.openWith.length - string.closeWith.length;
377
+					len = len - (string.block.match(/ $/) ? 1 : 0);
378
+					len -= fixIeBug(string.block);
379
+				} else if (shiftKey === true) {
380
+					string = build(selection);
381
+					start = caretPosition;
382
+					len = string.block.length;
383
+					len -= fixIeBug(string.block);
384
+				} else {
385
+					string = build(selection);
386
+					start = caretPosition + string.block.length ;
387
+					len = 0;
388
+					start -= fixIeBug(string.block);
389
+				}
390
+				if ((selection === '' && string.replaceWith === '')) {
391
+					caretOffset += fixOperaBug(string.block);
392
+					
393
+					start = caretPosition + string.openBlockWith.length + string.openWith.length;
394
+					len = string.block.length - string.openBlockWith.length - string.openWith.length - string.closeWith.length - string.closeBlockWith.length;
395
+
396
+					caretOffset = $$.val().substring(caretPosition,  $$.val().length).length;
397
+					caretOffset -= fixOperaBug($$.val().substring(0, caretPosition));
398
+				}
399
+				$.extend(hash, { caretPosition:caretPosition, scrollPosition:scrollPosition } );
400
+
401
+				if (string.block !== selection && abort === false) {
402
+					insert(string.block);
403
+					set(start, len);
404
+				} else {
405
+					caretOffset = -1;
406
+				}
407
+				get();
408
+
409
+				$.extend(hash, { line:'', selection:selection });
410
+
411
+				// callbacks after insertion
412
+				if ((ctrlKey === true && shiftKey === true) || button.multiline === true) {
413
+					prepare(clicked.afterMultiInsert);
414
+				}
415
+				prepare(clicked.afterInsert);
416
+				prepare(options.afterInsert);
417
+
418
+				// refresh preview if opened
419
+				if (previewWindow && options.previewAutoRefresh) {
420
+					refreshPreview(); 
421
+				}
422
+																									
423
+				// reinit keyevent
424
+				shiftKey = altKey = ctrlKey = abort = false;
425
+			}
426
+
427
+			// Substract linefeed in Opera
428
+			function fixOperaBug(string) {
429
+				if (browser.opera) {
430
+					return string.length - string.replace(/\n*/g, '').length;
431
+				}
432
+				return 0;
433
+			}
434
+			// Substract linefeed in IE
435
+			function fixIeBug(string) {
436
+				if (browser.msie) {
437
+					return string.length - string.replace(/\r*/g, '').length;
438
+				}
439
+				return 0;
440
+			}
441
+				
442
+			// add markup
443
+			function insert(block) {	
444
+				if (document.selection) {
445
+					var newSelection = document.selection.createRange();
446
+					newSelection.text = block;
447
+				} else {
448
+					textarea.value =  textarea.value.substring(0, caretPosition)  + block + textarea.value.substring(caretPosition + selection.length, textarea.value.length);
449
+				}
450
+			}
451
+
452
+			// set a selection
453
+			function set(start, len) {
454
+				if (textarea.createTextRange){
455
+					// quick fix to make it work on Opera 9.5
456
+					if (browser.opera && browser.version >= 9.5 && len == 0) {
457
+						return false;
458
+					}
459
+					range = textarea.createTextRange();
460
+					range.collapse(true);
461
+					range.moveStart('character', start); 
462
+					range.moveEnd('character', len); 
463
+					range.select();
464
+				} else if (textarea.setSelectionRange ){
465
+					textarea.setSelectionRange(start, start + len);
466
+				}
467
+				textarea.scrollTop = scrollPosition;
468
+				textarea.focus();
469
+			}
470
+
471
+			// get the selection
472
+			function get() {
473
+				textarea.focus();
474
+
475
+				scrollPosition = textarea.scrollTop;
476
+				if (document.selection) {
477
+					selection = document.selection.createRange().text;
478
+					if (browser.msie) { // ie
479
+						var range = document.selection.createRange(), rangeCopy = range.duplicate();
480
+						rangeCopy.moveToElementText(textarea);
481
+						caretPosition = -1;
482
+						while(rangeCopy.inRange(range)) {
483
+							rangeCopy.moveStart('character');
484
+							caretPosition ++;
485
+						}
486
+					} else { // opera
487
+						caretPosition = textarea.selectionStart;
488
+					}
489
+				} else { // gecko & webkit
490
+					caretPosition = textarea.selectionStart;
491
+
492
+					selection = textarea.value.substring(caretPosition, textarea.selectionEnd);
493
+				} 
494
+				return selection;
495
+			}
496
+
497
+			// open preview window
498
+			function preview() {
499
+				if (typeof options.previewHandler === 'function') {
500
+					previewWindow = true;
501
+				} else if (options.previewInElement) {
502
+					previewWindow = $(options.previewInElement);
503
+				} else if (!previewWindow || previewWindow.closed) {
504
+					if (options.previewInWindow) {
505
+						previewWindow = window.open('', 'preview', options.previewInWindow);
506
+						$(window).unload(function() {
507
+							previewWindow.close();
508
+						});
509
+					} else {
510
+						iFrame = $('<iframe class="markItUpPreviewFrame"></iframe>');
511
+						if (options.previewPosition == 'after') {
512
+							iFrame.insertAfter(footer);
513
+						} else {
514
+							iFrame.insertBefore(header);
515
+						}	
516
+						previewWindow = iFrame[iFrame.length - 1].contentWindow || frame[iFrame.length - 1];
517
+					}
518
+				} else if (altKey === true) {
519
+					if (iFrame) {
520
+						iFrame.remove();
521
+					} else {
522
+						previewWindow.close();
523
+					}
524
+					previewWindow = iFrame = false;
525
+				}
526
+				if (!options.previewAutoRefresh) {
527
+					refreshPreview(); 
528
+				}
529
+				if (options.previewInWindow) {
530
+					previewWindow.focus();
531
+				}
532
+			}
533
+
534
+			// refresh Preview window
535
+			function refreshPreview() {
536
+ 				renderPreview();
537
+			}
538
+
539
+			function renderPreview() {
540
+				var phtml;
541
+				var parsedData = $$.val();
542
+				if (options.previewParser && typeof options.previewParser === 'function') {
543
+					parsedData = options.previewParser(parsedData); 
544
+				}
545
+				if (options.previewHandler && typeof options.previewHandler === 'function') {
546
+					options.previewHandler(parsedData);
547
+				} else if (options.previewParserPath !== '') {
548
+					$.ajax({
549
+						type: options.previewParserAjaxType,
550
+						dataType: 'text',
551
+						global: false,
552
+						url: options.previewParserPath,
553
+						data: options.previewParserVar+'='+encodeURIComponent(parsedData),
554
+						success: function(data) {
555
+							writeInPreview( localize(data, 1) ); 
556
+						}
557
+					});
558
+				} else {
559
+					if (!template) {
560
+						$.ajax({
561
+							url: options.previewTemplatePath,
562
+							dataType: 'text',
563
+							global: false,
564
+							success: function(data) {
565
+								writeInPreview( localize(data, 1).replace(/<!-- content -->/g, parsedData) );
566
+							}
567
+						});
568
+					}
569
+				}
570
+				return false;
571
+			}
572
+			
573
+			function writeInPreview(data) {
574
+				if (options.previewInElement) {
575
+					$(options.previewInElement).html(data);
576
+				} else if (previewWindow && previewWindow.document) {			
577
+					try {
578
+						sp = previewWindow.document.documentElement.scrollTop
579
+					} catch(e) {
580
+						sp = 0;
581
+					}	
582
+					previewWindow.document.open();
583
+					previewWindow.document.write(data);
584
+					previewWindow.document.close();
585
+					previewWindow.document.documentElement.scrollTop = sp;
586
+				}
587
+			}
588
+			
589
+			// set keys pressed
590
+			function keyPressed(e) { 
591
+				shiftKey = e.shiftKey;
592
+				altKey = e.altKey;
593
+				ctrlKey = (!(e.altKey && e.ctrlKey)) ? (e.ctrlKey || e.metaKey) : false;
594
+
595
+				if (e.type === 'keydown') {
596
+					if (ctrlKey === true) {
597
+						li = $('a[accesskey="'+((e.keyCode == 13) ? '\\n' : String.fromCharCode(e.keyCode))+'"]', header).parent('li');
598
+						if (li.length !== 0) {
599
+							ctrlKey = false;
600
+							setTimeout(function() {
601
+								li.triggerHandler('mouseup');
602
+							},1);
603
+							return false;
604
+						}
605
+					}
606
+					if (e.keyCode === 13 || e.keyCode === 10) { // Enter key
607
+						if (ctrlKey === true) {  // Enter + Ctrl
608
+							ctrlKey = false;
609
+							markup(options.onCtrlEnter);
610
+							return options.onCtrlEnter.keepDefault;
611
+						} else if (shiftKey === true) { // Enter + Shift
612
+							shiftKey = false;
613
+							markup(options.onShiftEnter);
614
+							return options.onShiftEnter.keepDefault;
615
+						} else { // only Enter
616
+							markup(options.onEnter);
617
+							return options.onEnter.keepDefault;
618
+						}
619
+					}
620
+					if (e.keyCode === 9) { // Tab key
621
+						if (shiftKey == true || ctrlKey == true || altKey == true) {
622
+							return false; 
623
+						}
624
+						if (caretOffset !== -1) {
625
+							get();
626
+							caretOffset = $$.val().length - caretOffset;
627
+							set(caretOffset, 0);
628
+							caretOffset = -1;
629
+							return false;
630
+						} else {
631
+							markup(options.onTab);
632
+							return options.onTab.keepDefault;
633
+						}
634
+					}
635
+				}
636
+			}
637
+
638
+			function remove() {
639
+				$$.unbind(".markItUp").removeClass('markItUpEditor');
640
+				$$.parent('div').parent('div.markItUp').parent('div').replaceWith($$);
641
+
642
+				var relativeRef = $$.parent('div').parent('div.markItUp').parent('div');
643
+				if (relativeRef.length) {
644
+				    relativeRef.replaceWith($$);
645
+				}
646
+				
647
+				$$.data('markItUp', null);
648
+			}
649
+
650
+			init();
651
+		});
652
+	};
653
+
654
+	$.fn.markItUpRemove = function() {
655
+		return this.each(function() {
656
+				$(this).markItUp('remove');
657
+			}
658
+		);
659
+	};
660
+
661
+	$.markItUp = function(settings) {
662
+		var options = { target:false };
663
+		$.extend(options, settings);
664
+		if (options.target) {
665
+			return $(options.target).each(function() {
666
+				$(this).focus();
667
+				$(this).trigger('insertion', [options]);
668
+			});
669
+		} else {
670
+			$('textarea').trigger('insertion', [options]);
671
+		}
672
+	};
673
+})(jQuery);

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 27
admin/scripts/markitup/jquery.markitup.pack.js


admin/scripts/markitup/sets/html/images/bold.png → admin/scripts/markitup/sets/default/images/bold.png Datei anzeigen


admin/scripts/markitup/sets/html/images/clean.png → admin/scripts/markitup/sets/default/images/clean.png Datei anzeigen


admin/scripts/markitup/sets/html/images/image.png → admin/scripts/markitup/sets/default/images/image.png Datei anzeigen


admin/scripts/markitup/sets/html/images/italic.png → admin/scripts/markitup/sets/default/images/italic.png Datei anzeigen


admin/scripts/markitup/sets/html/images/link.png → admin/scripts/markitup/sets/default/images/link.png Datei anzeigen


admin/scripts/markitup/sets/html/images/list-bullet.png → admin/scripts/markitup/sets/default/images/list-bullet.png Datei anzeigen


admin/scripts/markitup/sets/html/images/list-numeric.png → admin/scripts/markitup/sets/default/images/list-numeric.png Datei anzeigen


admin/scripts/markitup/sets/html/images/picture.png → admin/scripts/markitup/sets/default/images/picture.png Datei anzeigen


admin/scripts/markitup/sets/html/images/preview.png → admin/scripts/markitup/sets/default/images/preview.png Datei anzeigen


admin/scripts/markitup/sets/html/images/stroke.png → admin/scripts/markitup/sets/default/images/stroke.png Datei anzeigen


+ 30 - 0
admin/scripts/markitup/sets/default/set.js Datei anzeigen

@@ -0,0 +1,30 @@
1
+// ----------------------------------------------------------------------------
2
+// markItUp!
3
+// ----------------------------------------------------------------------------
4
+// Copyright (C) 2011 Jay Salvat
5
+// http://markitup.jaysalvat.com/
6
+// ----------------------------------------------------------------------------
7
+// Html tags
8
+// http://en.wikipedia.org/wiki/html
9
+// ----------------------------------------------------------------------------
10
+// Basic set. Feel free to add more tags
11
+// ----------------------------------------------------------------------------
12
+var mySettings = {
13
+	onShiftEnter:  	{keepDefault:false, replaceWith:'<br />\n'},
14
+	onCtrlEnter:  	{keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
15
+	onTab:    		{keepDefault:false, replaceWith:'    '},
16
+	markupSet:  [ 	
17
+		{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
18
+		{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)'  },
19
+		{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
20
+		{separator:'---------------' },
21
+		{name:'Bulleted List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
22
+		{name:'Numeric List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
23
+		{separator:'---------------' },
24
+		{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
25
+		{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
26
+		{separator:'---------------' },
27
+		{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },		
28
+		{name:'Preview', className:'preview',  call:'preview'}
29
+	]
30
+}

+ 34 - 0
admin/scripts/markitup/sets/default/style.css Datei anzeigen

@@ -0,0 +1,34 @@
1
+/* -------------------------------------------------------------------
2
+// markItUp!
3
+// By Jay Salvat - http://markitup.jaysalvat.com/
4
+// ------------------------------------------------------------------*/
5
+.markItUp .markItUpButton1 a {
6
+	background-image:url(images/bold.png);
7
+}
8
+.markItUp .markItUpButton2 a {
9
+	background-image:url(images/italic.png);
10
+}
11
+.markItUp .markItUpButton3 a {
12
+	background-image:url(images/stroke.png);
13
+}
14
+
15
+.markItUp .markItUpButton4 a {
16
+	background-image:url(images/list-bullet.png); 
17
+}
18
+.markItUp .markItUpButton5 a {
19
+	background-image:url(images/list-numeric.png);
20
+}
21
+
22
+.markItUp .markItUpButton6 a {
23
+	background-image:url(images/picture.png); 
24
+}
25
+.markItUp .markItUpButton7 a {
26
+	background-image:url(images/link.png);
27
+}
28
+
29
+.markItUp .markItUpButton8 a {
30
+	background-image:url(images/clean.png);
31
+}
32
+.markItUp .preview a {
33
+	background-image:url(images/preview.png);
34
+}

BIN
admin/scripts/markitup/sets/html/images/code.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/fonts.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/h1.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/h2.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/h3.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/h4.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/h5.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/h6.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/list-item.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/more.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/paragraph.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/quotes.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/underline.png Datei anzeigen


BIN
admin/scripts/markitup/sets/html/images/url.png Datei anzeigen


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 1
admin/scripts/markitup/sets/html/set.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 1
admin/scripts/markitup/sets/html/style.css


BIN
admin/scripts/markitup/skins/markitup/images/bg-container.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-bbcode.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-dotclear.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-html.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-json.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-markdown.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-textile.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-wiki.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor-xml.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/bg-editor.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/handle.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/menu.png Datei anzeigen


BIN
admin/scripts/markitup/skins/markitup/images/submenu.png Datei anzeigen


+ 147 - 0
admin/scripts/markitup/skins/markitup/style.css Datei anzeigen

@@ -0,0 +1,147 @@
1
+/* -------------------------------------------------------------------
2
+// markItUp! Universal MarkUp Engine, JQuery plugin
3
+// By Jay Salvat - http://markitup.jaysalvat.com/
4
+// ------------------------------------------------------------------*/
5
+.markItUp * {
6
+	margin:0px; padding:0px;
7
+	outline:none;
8
+}
9
+.markItUp a:link,
10
+.markItUp a:visited {
11
+	color:#000;
12
+	text-decoration:none;
13
+}
14
+.markItUp  {
15
+	width:700px;
16
+	margin:5px 0 5px 0;
17
+	border:5px solid #F5F5F5;	
18
+}
19
+.markItUpContainer  {
20
+	border:1px solid #3C769D;	
21
+	background:#FFF url(images/bg-container.png) repeat-x top left;
22
+	padding:5px 5px 2px 5px;
23
+	font:11px Verdana, Arial, Helvetica, sans-serif;
24
+}
25
+.markItUpEditor {
26
+	font:12px 'Courier New', Courier, monospace;
27
+	padding:5px 5px 5px 35px;
28
+	border:3px solid #3C769D;
29
+	width:643px;
30
+	height:320px;
31
+	background:#FFF url(images/bg-editor.png) no-repeat;
32
+	clear:both;
33
+	line-height:18px;
34
+	overflow:auto;
35
+}
36
+.markItUpPreviewFrame	{
37
+	overflow:auto;
38
+	background-color:#FFFFFF;
39
+	border:1px solid #3C769D;
40
+	width:99.9%;
41
+	height:300px;
42
+	margin:5px 0;
43
+}
44
+.markItUpFooter {
45
+	width:100%;
46
+	cursor:n-resize;
47
+}
48
+.markItUpResizeHandle {
49
+	overflow:hidden;
50
+	width:22px; height:5px;
51
+	margin-left:auto;
52
+	margin-right:auto;
53
+	background-image:url(images/handle.png);
54
+	cursor:n-resize;
55
+}
56
+/***************************************************************************************/
57
+/* first row of buttons */
58
+.markItUpHeader ul li	{
59
+	list-style:none;
60
+	float:left;
61
+	position:relative;
62
+}
63
+.markItUpHeader ul li ul{
64
+	display:none;
65
+}
66
+.markItUpHeader ul li:hover > ul{
67
+	display:block;
68
+}
69
+.markItUpHeader ul .markItUpDropMenu {
70
+	background:transparent url(images/menu.png) no-repeat 115% 50%;
71
+	margin-right:5px;
72
+}
73
+.markItUpHeader ul .markItUpDropMenu li {
74
+	margin-right:0px;
75
+}
76
+.markItUpHeader ul .markItUpSeparator {
77
+	margin:0 10px;
78
+	width:1px;
79
+	height:16px;
80
+	overflow:hidden;
81
+	background-color:#CCC;
82
+}
83
+.markItUpHeader ul ul .markItUpSeparator {
84
+	width:auto; height:1px;
85
+	margin:0px;
86
+}
87
+/* next rows of buttons */
88
+.markItUpHeader ul ul {
89
+	display:none;
90
+	position:absolute;
91
+	top:18px; left:0px;	
92
+	background:#F5F5F5;
93
+	border:1px solid #3C769D;
94
+	height:inherit;
95
+}
96
+.markItUpHeader ul ul li {
97
+	float:none;
98
+	border-bottom:1px solid #3C769D;
99
+}
100
+.markItUpHeader ul ul .markItUpDropMenu {
101
+	background:#F5F5F5 url(images/submenu.png) no-repeat 100% 50%;
102
+}
103
+/* next rows of buttons */
104
+.markItUpHeader ul ul ul {
105
+	position:absolute;
106
+	top:-1px; left:150px;
107
+}
108
+.markItUpHeader ul ul ul li {
109
+	float:none;
110
+}
111
+.markItUpHeader ul a {
112
+	display:block;
113
+	width:16px; height:16px;
114
+	text-indent:-10000px;
115
+	background-repeat:no-repeat;
116
+	padding:3px;
117
+	margin:0px;
118
+}
119
+.markItUpHeader ul ul a {
120
+	display:block;
121
+	padding-left:0px;
122
+	text-indent:0;
123
+	width:120px; 
124
+	padding:5px 5px 5px 25px;
125
+	background-position:2px 50%;
126
+}
127
+.markItUpHeader ul ul a:hover  {
128
+	color:#FFF;
129
+	background-color:#3C769D;
130
+}
131
+/***************************************************************************************/
132
+.html .markItUpEditor {
133
+	background-image:url(images/bg-editor-html.png);
134
+}
135
+.markdown .markItUpEditor {
136
+	background-image:url(images/bg-editor-markdown.png);
137
+}
138
+.textile .markItUpEditor {
139
+	background-image:url(images/bg-editor-textile.png);
140
+}
141
+.bbcode .markItUpEditor {
142
+	background-image:url(images/bg-editor-bbcode.png);
143
+}
144
+.wiki .markItUpEditor,
145
+.dotclear .markItUpEditor {
146
+	background-image:url(images/bg-editor-wiki.png);
147
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 118 - 1
admin/scripts/markitup/skins/simple/style.css


+ 5 - 0
admin/scripts/markitup/templates/preview.css Datei anzeigen

@@ -0,0 +1,5 @@
1
+/* preview style examples */
2
+body {
3
+	background-color:#EFEFEF;
4
+	font:70% Verdana, Arial, Helvetica, sans-serif;
5
+}

+ 11 - 0
admin/scripts/markitup/templates/preview.html Datei anzeigen

@@ -0,0 +1,11 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+<html xmlns="http://www.w3.org/1999/xhtml">
3
+<head>
4
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+<title>markItUp! preview template</title>
6
+<link rel="stylesheet" type="text/css" href="~/templates/preview.css" />
7
+</head>
8
+<body>
9
+<!-- content -->
10
+</body>
11
+</html>