annotate wiki.js @ 15:c94bd26e0e67

Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
author Atul Varma <varmaa@toolness.com>
date Sun, 01 Feb 2009 18:35:33 -0800
parents f8354a940524
children 20b6dbeb6250
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
1 /* ***** BEGIN LICENSE BLOCK *****
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
3 *
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
4 * The contents of this file are subject to the Mozilla Public License Version
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
5 * 1.1 (the "License"); you may not use this file except in compliance with
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
6 * the License. You may obtain a copy of the License at
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
7 * http://www.mozilla.org/MPL/
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
8 *
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
9 * Software distributed under the License is distributed on an "AS IS" basis,
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
11 * for the specific language governing rights and limitations under the
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
12 * License.
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
13 *
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
14 * The Original Code is Ubiquity.
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
15 *
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
16 * The Initial Developer of the Original Code is Mozilla.
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
17 * Portions created by the Initial Developer are Copyright (C) 2007
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
18 * the Initial Developer. All Rights Reserved.
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
19 *
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
20 * Contributor(s):
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
21 * Atul Varma <atul@mozilla.com>
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
22 *
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
23 * Alternatively, the contents of this file may be used under the terms of
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
26 * in which case the provisions of the GPL or the LGPL are applicable instead
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
27 * of those above. If you wish to allow use of your version of this file only
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
28 * under the terms of either the GPL or the LGPL, and not to allow others to
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
29 * use your version of this file under the terms of the MPL, indicate your
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
30 * decision by deleting the provisions above and replace them with the notice
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
31 * and other provisions required by the GPL or the LGPL. If you do not delete
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
32 * the provisions above, a recipient may use your version of this file under
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
33 * the terms of any one of the MPL, the GPL or the LGPL.
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
34 *
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
35 * ***** END LICENSE BLOCK ***** */
f8354a940524 Added license block.
Atul Varma <varmaa@toolness.com>
parents: 13
diff changeset
36
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
37 var App = {
13
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
38 PART_SEPARATOR: "\n\n",
15
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
39 creole: null,
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
40 editingElement: null,
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
41 eventHandlers: {}
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
42 };
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
43
5
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
44 App.eventHandlers.editPart = function editPart(aEvt) {
2
1d3d91674bbe Users must hold down shift while clicking to edit.
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
45 if (!aEvt.shiftKey)
1d3d91674bbe Users must hold down shift while clicking to edit.
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
46 return;
1d3d91674bbe Users must hold down shift while clicking to edit.
Atul Varma <varmaa@toolness.com>
parents: 1
diff changeset
47
3
ac7e15dcee69 Activate edits on mousedown instead of click to prevent default selection behavior.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
48 aEvt.preventDefault();
ac7e15dcee69 Activate edits on mousedown instead of click to prevent default selection behavior.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
49
10
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
50 App.enterEditMode([this], 1);
8
a199d2ca2d06 Minor refactoring.
Atul Varma <varmaa@toolness.com>
parents: 6
diff changeset
51 };
a199d2ca2d06 Minor refactoring.
Atul Varma <varmaa@toolness.com>
parents: 6
diff changeset
52
12
0158bed7e0c6 Minor refactoring: added App.getMarkup().
Atul Varma <varmaa@toolness.com>
parents: 11
diff changeset
53 App.getMarkup = function getMarkup(parts) {
10
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
54 var partsMarkup = [];
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
55 $(".creole-markup", parts).each(
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
56 function(i) { partsMarkup.push($(this).text()); }
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
57 );
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
58
13
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
59 return partsMarkup.join(App.PART_SEPARATOR);
12
0158bed7e0c6 Minor refactoring: added App.getMarkup().
Atul Varma <varmaa@toolness.com>
parents: 11
diff changeset
60 };
0158bed7e0c6 Minor refactoring: added App.getMarkup().
Atul Varma <varmaa@toolness.com>
parents: 11
diff changeset
61
13
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
62 App.enterEditMode = function enterEditMode(parts, level, cursorPos) {
15
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
63 if (App.editingElement) {
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
64 $(App.editingElement).blur();
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
65 App.editingElement = null;
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
66 }
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
67
11
98a77c9b13ea Fixed an annoying bug.
Atul Varma <varmaa@toolness.com>
parents: 10
diff changeset
68 var editablePart = $('<textarea class="wiki-edit"></textarea>').get(0);
12
0158bed7e0c6 Minor refactoring: added App.getMarkup().
Atul Varma <varmaa@toolness.com>
parents: 11
diff changeset
69 $(editablePart).attr("value", App.getMarkup(parts));
1
dd457cc7c596 Improved setting of size of textarea.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
70
dd457cc7c596 Improved setting of size of textarea.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
71 function setScrollHeight() {
9
20ed90d10dee Replaced use of closure variables w/ use of 'this'.
Atul Varma <varmaa@toolness.com>
parents: 8
diff changeset
72 $(this).height(this.scrollHeight);
1
dd457cc7c596 Improved setting of size of textarea.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
73 }
dd457cc7c596 Improved setting of size of textarea.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
74
10
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
75 function exitEditMode() {
9
20ed90d10dee Replaced use of closure variables w/ use of 'this'.
Atul Varma <varmaa@toolness.com>
parents: 8
diff changeset
76 var markup = $(this).attr("value");
20ed90d10dee Replaced use of closure variables w/ use of 'this'.
Atul Varma <varmaa@toolness.com>
parents: 8
diff changeset
77 $(this).replaceWith(App.createParts(markup));
10
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
78 }
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
79
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
80 function editSiblings(aEvt) {
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
81 if (!aEvt.shiftKey || level == 0)
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
82 return;
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
83
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
84 aEvt.preventDefault();
1
dd457cc7c596 Improved setting of size of textarea.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
85
13
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
86 var prevMarkup = App.getMarkup($(this).prevAll());
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
87 var cursorPos = (prevMarkup.length + App.PART_SEPARATOR.length +
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
88 this.selectionStart);
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
89
10
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
90 var allSiblings = this.parentNode.childNodes;
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
91 exitEditMode.apply(this);
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
92
13
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
93 App.enterEditMode(allSiblings, level-1, cursorPos);
10
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
94 }
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
95
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
96 $(editablePart).blur(exitEditMode);
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
97 $(editablePart).mousedown(editSiblings);
5
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
98 $(editablePart).keyup(setScrollHeight);
10
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
99 $(parts).filter(":not(:first)").remove();
ec3ec75a8d16 The user can now 'zoom out' while editing by shift-clicking the edit field.
Atul Varma <varmaa@toolness.com>
parents: 9
diff changeset
100 $(parts).replaceWith(editablePart);
9
20ed90d10dee Replaced use of closure variables w/ use of 'this'.
Atul Varma <varmaa@toolness.com>
parents: 8
diff changeset
101 setScrollHeight.apply(editablePart);
1
dd457cc7c596 Improved setting of size of textarea.
Atul Varma <varmaa@toolness.com>
parents: 0
diff changeset
102
13
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
103 if (typeof(cursorPos) != "undefined") {
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
104 editablePart.selectionStart = cursorPos;
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
105 editablePart.selectionEnd = cursorPos;
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
106 }
15
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
107
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
108 App.editingElement = editablePart;
5
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
109 $(editablePart).focus();
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
110 };
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
111
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
112 App.createPart = function createPart(markup) {
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
113 var partDiv = $('<div class="part"></div>');
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
114 var markupDiv = $('<div class="creole-markup"></div>');
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
115 markupDiv.text(markup);
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
116 App.creole.parse(partDiv.get(0), markup);
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
117 partDiv.mousedown(App.eventHandlers.editPart);
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
118 partDiv.append(markupDiv);
6
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
119 return partDiv.get(0);
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
120 };
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
121
6
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
122 App.createParts = function createParts(text) {
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
123 var parts = [];
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
124
13
c0edd32443a7 Cursor position is now preserved when moving from editing a part to editing the whole document.
Atul Varma <varmaa@toolness.com>
parents: 12
diff changeset
125 var partsMarkup = text.split(App.PART_SEPARATOR);
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
126 jQuery.each(
6
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
127 partsMarkup,
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
128 function(i) {
5
06e8c49e9dec Wikicreole markup is now editable. Also refactored things a bit so that variables have better names, DRY is preserved better.
Atul Varma <varmaa@toolness.com>
parents: 4
diff changeset
129 var partMarkup = this.toString();
6
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
130 if (partMarkup)
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
131 parts.push(App.createPart(partMarkup));
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
132 }
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
133 );
6
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
134
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
135 return parts;
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
136 };
0
2e5a6f077df2 Origination
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
137
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
138 App.eventHandlers.onLoad = function onLoad() {
15
c94bd26e0e67 Fixed a bug whereby if the user tried editing an element while already editing a different one, weird things would happen.
Atul Varma <varmaa@toolness.com>
parents: 14
diff changeset
139 App.creole = new Parse.Simple.Creole(
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
140 {interwiki: {
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
141 WikiCreole: 'http://www.wikicreole.org/wiki/',
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
142 Wikipedia: 'http://en.wikipedia.org/wiki/'
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
143 },
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
144 linkFormat: ''
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
145 });
0
2e5a6f077df2 Origination
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
146
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
147 jQuery.get("wiki.txt",
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
148 {},
6
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
149 function(text) {
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
150 $("#content").append(App.createParts(text));
fb233578283c User can now create new wiki markup parts (i.e., paragraphs).
Atul Varma <varmaa@toolness.com>
parents: 5
diff changeset
151 },
4
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
152 "text");
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
153 };
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
154
01313b55ed09 We're now loading from wikicreole markup contained in wiki.txt, though editing fields still edits their HTML, not their wiki markup.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
155 $(window).ready(App.eventHandlers.onLoad);