Wiki source code of Page Editing

Version 271.1 by Marius Dumitru Florea on 2020/04/29

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 In XWiki all pages are editable (provided you are logged in and/or have the edit rights). To edit a page, all you have to do is to click the arrow in the "Edit" button. Please note the location of the "Edit" button varies depending on the skin your wiki is using.
6
7 If you're using the [[Flamingo skin>>extensions:Extension.Flamingo Skin]] you should see the following:
8
9 {{image reference="EditSimpleModeFlamingo.png"/}}
10
11 = Simple and Advanced editing modes =
12
13 Since XWiki is an [[application wiki>>platform:Main.SecondGenerationWiki]], not all users will need to use the same features. This is why XWiki comes with a Simple and an Advanced editing mode. Users can easily choose which editing mode they prefer on their profile (available at the top right of the page when you are logged in). This way, standard users do not have to choose between editing modes they may not be familiar with. By default new users are given the Simple editing mode but they can switch to the Advanced mode as described below.
14
15 == Simple Mode ==
16
17 Clicking on the "Edit" button has the following behavior for a simple user:
18
19 * if the current page is displayed by a sheet (e.g. if the page has an object attached that has a sheet associated) then the page will be edited in [[Inline form>>#HFormeditingmode28akainlinemode29]] edit mode
20 * if the current page has no sheet (i.e. it's a plain wiki page) then:
21 ** if the prefered content editor is the WYSIWYG editor and the syntax of the current page supports WYSIWYG editing then the page will be [[edited in-place>>#HIn-placeediting]] ({{info}}since 12.3{{/info}}) or in [[WYSIWYG edit mode>>#HWYSIWYGeditingmode]] (before 12.3)
22 ** othewise, the page will be edited in [[Wiki edit mode>>#HWikieditingmode]]
23
24 == Advanced Mode ==
25
26 Experienced XWiki users will want to use all the editing choices (particularly those who want to use XWiki programming features). They can choose to switch to advanced mode on their user profile page (see image below). Following this, clicking on the arrow in the "Edit" button on any page will display the full editing menu, letting the user choose which mode he wants to use ("Wiki", "Inline form", "Objects"...).
27
28 {{image reference="AdvancedEditMode.png"/}}
29 Once you have switched to advanced mode, the "Edit" menu will look like this on mouse click:
30
31 {{image reference="EditAdvancedMode.png"/}}
32
33 * [[Form Editing Mode>>platform:Features.PageEditing#HFormeditingmode28akainlinemode29]]
34 * [[Object Editing Mode>>platform:Features.PageEditing#HObjectseditingmode]]
35 * [[Class Editing Mode>>platform:Features.PageEditing#HClasseseditingmode]]
36 * [[Access Rights Editing Mode>>platform:Features.PageEditing#HAccessRightseditingmode]]. Note that this menu entry will only appear for Terminal pages. For Nested Pages, you'll be able to access rights by clicking on the "Administer Page" entry in the "More Actions" menu (3 vertical dots menu).
37
38 In addition, advanced users have the ability to [[create Terminal pages>>platform:Features.DocumentLifecycle||anchor="HByusingtheAddPageaction"]] (i.e. pages that can't have children).
39
40 = Common edit actions =
41
42 All edit modes have some or all of the elements in the following image :
43
44 {{image reference="autosave.png"/}}
45
46 {{info}}
47 A wiki document's version is composed of two numbers. Saving a major change will increase the first component and reset the second to "1", while a minor edit will just increase the second component.
48 {{/info}}
49
50 The **minor edit** checkbox is meant to mark the fact that superficial changes were made to the document. Such changes may include, but are not restricted to: spelling error corrections, text rearrangements, formatting. It is the editor's responsibility to distinguish between major and minor changes.
51
52 By default, minor edits do not appear in the "What's New" page and in the document history. The option "Show minor edits" will list all the versions, including minor ones.
53
54 The **Version summary** field allows entering a short description of the changes made to the document in the version that is being saved. It is displayed in the history page and it is meant to increase comprehensibility of the content's evolution.
55
56 The **Cancel** button causes the changes to be discarded and forwards to the document view mode.
57
58 The **Preview** button shows the document as it would look with the current changes saved, but does not actually change the document. From the preview mode, the user will be able to cancel the changes, return to edit mode or save the changes. This button is not available in all edit modes.
59
60 The **Save & Continue** button submits the current changes and returns to the current edit mode.
61
62 The **Save & View** button submits the current changes and returns to the document view mode.
63
64 == Autosave ==
65
66 The Autosave feature automatically saves the document you're working on as a minor version at a given interval. Just check the Autosave checkbox next to the action buttons, at the bottom of the editing area. You can optionally change the autosave interval by entering the desired number of minutes in the input following the checkbox.
67
68 {{warning}}
69 Note that this feature is still not fully mature since it creates a new revision of the document every N seconds (where N is the time interval you specify). This means a document may have a lot of revisions which will potentially hamper performances and history readability. In the future one idea is to [[implement the notion of pseudo versions>>https://jira.xwiki.org/browse/XWIKI-500]].
70 {{/warning}}
71
72 = In-place editing =
73
74 TODO
75
76 = Wiki editing mode =
77
78 This is a mode you should be familiar with if you're already a wiki user. In this mode you can enter text using a simple [[Wiki Syntax>>platform:Main.XWikiSyntax]]. Note that the [[Help Application>>extensions:Extension.Help Application]] provides help on the syntax when editing a page.
79
80 This is how the wiki edit mode looks like with the Flamingo skin:
81
82 {{image reference="WikiEditing.png"/}}
83
84 == Choosing a Syntax ==
85
86 You have the option to choose what syntax you want to use for writing the content of the page (see the [[XWiki Syntax Guide>>platform:Main.XWikiSyntax]] for more details and the [[Rendering wiki>>rendering:Main.WebHome]] for a full list of available syntaxes). To choose the syntax to use for the current page, go in wiki edit mode and in the Information Panel select the syntax to use.
87
88 {{info}}
89 By default only the latest XWiki syntax is enabled, but you can [[configure other syntaxes>>extensions:Extension.Rendering Administration Application]] from the "Global Administration > Editing > Syntaxes", as shown in the screenshot below.
90 {{/info}}
91
92 For example using the Flamingo Skin:
93
94 {{image reference="Syntax2.png"/}}
95
96 == Converting between Syntaxes ==
97
98 If you already have content for the page in a given Syntax and you try to change the Syntax to another one then XWiki will propose to convert your content to the new Syntax if it knows how to perform that conversion (converting to XWiki Syntax 2.0+ will always prompt for a conversion). The quality of the conversion will usually be good but may depend on the quality of the original Syntax; for example converting from XWiki Syntax 1.0 to XWiki Syntax 2.0+ may not generate perfect result and you'll need to review manually the result.
99
100 = WYSIWYG editing mode =
101
102 This mode is ideal for first time users or people who do not want to use the Wiki Syntax. It's a mode similar to the one used by your favorite word processor in which you see how what you type is rendered. There's a toolbar available to add special effects to your text, add images, insert links, add macros, etc.
103
104 {{image reference="wysiwyg.png"/}}
105
106 Read the [[documentation for using the WYSIWYG editor>>extensions:Extension.CKEditor Integration.WebHome]] for more details.
107
108 = Setting the page parent =
109
110 {{info}}
111 Starting with XWiki 7.2, the concept of setting the page parent has been deprecated in favor of the [[Nested Pages feature>>Documentation.UserGuide.Features.ContentOrganization.WebHome]]. The location of a page is no longer controlled by the "parent" field. In order to change a page's location you now need to Rename or Move it to another location.
112
113 For example a page "CEO" inside a page "Boarding" inside a page "Management" inside a page "Staff" you would have the following Breadcrumb:
114
115 {{image reference="referencebreadcrumb.png"/}}
116 {{/info}}
117
118 {{info}}XWiki < 7.2{{/info}} In order to have an organized structure of your page, when you create a new page in a space, its parent will be automatically set to be the WebHome page of the space in which you create the page.
119
120 If you want to change the parent of the page, you have to edit the page with wiki or wysiwyg editors.
121
122 {{image reference="documentParent.png"/}}
123
124 Click on the small pencil above the page title in order to edit the page parent.
125
126 {{image reference="documentParentCollapsed.png"/}}
127
128 {{info}}
129 If the page has no parent set, the breadcrumbs feature will not show the path to navigate from the Main.WebHome to the page. These pages are called orphan pages.
130 {{/info}}
131
132 {{image reference="documentParentNoParent.png"/}}
133
134 {{image reference="pageNoBreadcrumb.png"/}}
135
136 {{warning}}
137 Please note that when you copy a page, its parent field will not be updated accordingly to the new space the copy is in. You will have to do that manually.
138 {{/warning}}
139
140 = Hiding Pages =
141
142 It's possible to hide (or unhide) pages. When a page is hidden, it'll still be visible if you navigate explicitly to it but it'll disappear from Search, Page Index, Navigation Trees, etc. However the hidden page will still be visible to users who've [[configured their user profile to show Hidden Pages>>extensions:Extension.User Profile Application#HEditPreferences]]. By default users don't see hidden pages. Also note that the SuperAdmin user always sees hidden pages ({{info}}Since 12.2{{/info}}).
143
144 To hide a page, edit it in Wiki or WYSIWYG edit mode and set the flag as shown below:
145
146 {{image reference="hiding.png"/}}
147
148 {{info}}
149 When you're a "Simple" user, you only have a single Edit button available and when clicked that takes you to the default edit mode. If the page you're editing is configured to use the "Form" editor then you won't see the side panel as on the screenshot above. Thus you'll need to [[switch to being an "Advanced" user and Edit in Wiki or WYSIWYG mode>>#HAdvancedMode]].
150 {{/info}}
151
152 {{info}}
153 Hiding is not replacing permissions which is what you'll use if you want to make pages not visible to some user or group.
154 {{/info}}
155
156 = Form editing mode (aka inline mode) =
157
158 Inline mode, or Form mode, is a special feature of XWiki, that allows administrators to define patterns of structured information (like a blog entry, or a standard tax form). Pages containing such structured information can be edited and re-edited as simple HTML Forms, which have (almost) the same structure as the displayed page. Thus, when clicking the edit button, it seems that the page content can be edited in-place, or inline and the form view is automatically displayed.
159
160 Technically the inline mode is triggered automatically differently whether the page is written in XWiki Syntax 1.0 or 2.0, using the following algorithm:
161
162 * XWiki Syntax 1.0: If the page contains a call to ###includeForm()##
163 * XWiki Syntax 2.0: If the page has an associated sheet (see the [[Developer documentation for the Sheet Module>>extensions:Extension.Sheet Module]])
164
165 Note that it is beyond the scope of this simple guide to explain the programming technique supporting this feature. Please check the [[Developer's Guide>>platform:DevGuide.WebHome]] to find out more about programming with Objects/Classes and Forms.
166
167 = Objects editing mode =
168
169 In XWiki it's possible to attach Objects to pages. Objects are simple sets of properties with values that add additional information about a page. For example a security right can be added to a page to control its rights, a blog object is attached to a page representing a blog entry, etc. Again, it's beyond this simple guide to explain this programming technique. Please check the [[Developer's Guide>>platform:DevGuide.WebHome]] to know more about programming with Objects/Classes.
170
171 {{image reference="ObjectEditor.png"/}}
172
173 = Classes editing mode =
174
175 We've seen that some pages can have Objects attached to them. Some pages can also be Object definitions, a.k.a Classes. The Classes editing mode calls the class editor on the current page, allowing to edit the Classes attached to the document. Again, it's beyond this simple guide to explain this programming technique. Please check the [[Developer's Guide>>platform:DevGuide.WebHome]] to find out more about programming with Objects/Classes.
176
177 {{image reference="ClassEditor.png"/}}
178
179 = Access Rights editing mode =
180
181 This mode allows you to control the access rights for the page you're viewing (you need to have the required access rights to modify a page's rights). See the [[Rights Management>>platform:Features.RightsManagement]] topic for more information.
182
183 = Full Screen Mode =
184
185 A full-screen mode is available in XWiki. When editing a page either in Wiki or WYSIWYG mode, clicking on the button at the top right of the edit box will send the editor in full-screen mode. You can then edit your page as usual and click on the button to return to the usual interface when you are finished.
186
187 //The button you need to click to go in full-screen mode//
188 {{image reference="FullScreenButton.png"/}}
189
190 //Editing while in full-screen mode//
191 {{image reference="FullScreen.png"/}}
192
193 = Title Behavior =
194
195 Pages have both names and titles. The page name is used in the URL to the page while the title is used to display a user-friendly short description of the page. The title is used for example as the top level headings when viewing a page.
196
197 Page titles can be set while editing documents in Wiki or WYSIWYG modes.
198
199 Titles are not mandatory by default but it's possible to [[configure XWiki to make titles mandatory>>platform:AdminGuide.Configuration#HTitlebehavior]].
200
201 The title's content is parsed using Velocity so you're also allowed to put Velocity content in there in addition to plain text (this is for example useful when wanting to internationalize titles). Note that you're not allowed to use any wiki markup.
202
203 When a page has no title set then XWiki will use the page name as its title.
204
205 {{info}}
206 It's also possible to [[configure XWiki to extract the topmost heading>>platform:AdminGuide.Configuration#HTitlebehavior]] from the document's content. For example if you have a level 1 heading, it'll be used as the page title. If you don't have a level 1 heading but have a level 2 heading then the level 2 heading will be used as the page title. The heading level depth XWiki used for titles is controlled in [[XWiki's title configuration>>platform:AdminGuide.Configuration#HTitlebehavior]]. Since you're allowed to use any wiki syntax in headings, if a page doesn't have a title set (and titles are not mandatory) then any wiki markup in the topmost headings will get rendered when displaying the extracted title for that page.
207
208 However this is a backward compatibility option and we do not recommend that you use it. The reason we deprecated this behavior that allowed styling the titles is because it leads to all sorts of issues:
209
210 * The title is used in several places including the browser's title or in LiveTable results and since those places forces to display the title in plain text, this means you'd see wiki markup or HTML displayed as is
211 * When the heading is generated through a script, if that script gets executed outside of the page's rendering context, it can lead to side effects and the page title displayed in LiveTable or other places can be completely wrong
212 {{/info}}
213
214 = Locking =
215
216 By default, when you edit a page, a lock is put on the page (the duration [[can be configured>>Documentation.AdminGuide.Configuration.WebHome#HLockDuration]]), till you either Save (any kind of Save), Cancel the edition or close the browser window.
217
218 If you keep the page open in the browser without doing any Save action, the lock will be active by default for 30 minutes (see [[lock duration>>Documentation.AdminGuide.Configuration.WebHome#HLockDuration]] configuration).
219
220 Anyone trying to edit a page that is locked will see the following warning message allowing you to know that the page is locked and also to force the lock.
221
222 {{image reference="lock.png"/}}
223
224 If you force the lock then the last user who saves will overwrite the content with his version of the page.
225
226 = Edit conflict =
227
228 Starting with {{info}}XWiki 11.2RC1{{/info}} we detect during the edition of a document if a conflict might happen when saving the page. If this warning occurs, this means someone edited and saved the document while you were working on it.
229
230 Starting with {{info}}XWiki 11.3.1 and XWiki 11.4RC1{{/info}} you have two main choices:
231
232 * force save the page: in that case you will override saved while you were editing the page; they are not really lost though since they might be retrieved in the previous version of the page.
233 * reload the editor: in that case your changes **will be lost** and the editor will be reloaded with the last version saved.
234
235 We display the diff between the version you're trying to save and the last version that has been saved, so you can copy some changes made and reapply them if you like.
236 Note that you can also simply cancel the save and go back to the editor to make changes before trying again to save.
237 You can click on the arrow of each action to have a quick description of what it actually means.
238
239 {{gallery}}
240 image:edit-conflict-reload.png
241 image:edit-conflict-force-save.png
242 {{/gallery}}
243
244
245 We improve with {{info}}XWiki 11.5RC1{{/info}} the support of conflict edition by implementing a merge on save mechanism. This means that in case of conflict edition (two users saving the same document at the same time), instead of always displaying a window to the user asking what to do, we first try to perform a merge of both document. If the changes concerned two very different parts of the document (two different sections, an edit performed on an object against an edit of the content, etc) the user won't notice that a merge has been performed.
246
247 Now, some conflicts might still occur if both users tried to edit the same part of the document. In that case, a new window is displayed asking the user what to do.
248 The user will now have three different choices:
249
250 * Merge the document and fix conflict with his/her own changes: this means that as much as possible, we try to merge the changes. Only for the part that are conflicting, we only kept the changes from the last user. This is the recommended choice.
251 * Force save the document: this means no merge at all will be performed. Only the changes performed by the last user will be saved. It basically discards the changes made by the previous user.
252 * Reload the editor: this choice might be taken very carefully as it might cause a loss of data. It means that the current changes performed on the document will be completely lost and the editor will be reloaded with the last changes.
253
254 The conflict window now display the changes that will be performed for each choices. Be careful with the parts in red since it shows what part of the document will be lost during the operation. Note that it's also possible to select two specific versions of the document to perform a comparison before making a choice.
255
256 {{gallery}}
257 image:merge-conflict-modal-usage-v2.gif
258 {{/gallery}}
259
260 {{info}}
261 Starting with {{code}}XWiki 11.3.2 and XWiki 11.6RC1{{/code}} the whole feature can be disabled from the xwiki.properties file by setting {{code}}edit.conflictChecking.enabled = false{{/code}}.
262 {{/info}}
263
264 Starting with {{code}}XWiki 11.8RC1{{/code}} the conflict edition window allows one more choice: to fix each conflict individually.
265 This new choice is marked as advanced since it's not something easy to handle.
266
267 {{gallery}}
268 image:custom_conflict_resolution.png
269 image:custom_conflict_fix.gif
270 {{/gallery}}
271
272 When choosing the new option, the UI is updated to display the changes between the latest version saved and the current version the user is trying to save. At each place a conflict occurred, the changes display an orange bar and a blue area is reserved for the conflict resolution.
273 This blue area displays some text, and a select with several choices. The displayed text in the blue area is what will be used for fixing the conflict, you can see the text changing for each choice.
274
275 The conflict choices are the following:
276
277 * current version (default): the conflict is fixed by getting the current changes
278 * before your changes: the conflict is fixed by getting what was there before you starting to edit. Both latest version saved and your current changes would be lost for this conflict,
279 * latest version saved: the change made on the latest version saved (the one you are conflicting with) are taken to fix the conflict
280 * custom version: with this option, a text area is displayed to allow you to enter any new value to fix the conflict. Multiple lines can be entered.
281
282 If the choice text displays something in red, it is because no content is actually available for the chosen version to fix the conflict: usually it means the content in conflict will be removed with the choice made.
283
284 = Extension page protection =
285
286 Since 10.3, extension pages are protected against editing ([[unless explicitly indicated otherwise in the extension>>http://extensions.xwiki.org/xwiki/bin/view/Extension/XAR%20Module%20Specifications#Hpackage.xml]]) to avoid mistake a user could make while still allowing advanced users to force it if really required.
287
288 {{image reference="editprotection.png"/}}
289
290 = Default Language =
291
292 If you've set up your wiki to be multingual, then when editing a page using the wiki editor, you'll be able to set the default language for the current page as in:
293
294 {{image reference="defaultLanguage.png"/}}

Get Connected