Skip to content

Commit a1455a5

Browse files
author
Satvik Kumar
committed
Add UI buttons for list creation
1 parent 9064ead commit a1455a5

2 files changed

Lines changed: 93 additions & 1 deletion

File tree

programs/editor/Tools.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ define("webodf/editor/Tools", [
3232
"dijit/form/DropDownButton",
3333
"dijit/Toolbar",
3434
"webodf/editor/widgets/paragraphAlignment",
35+
"webodf/editor/widgets/toggleLists",
3536
"webodf/editor/widgets/simpleStyles",
3637
"webodf/editor/widgets/undoRedoMenu",
3738
"webodf/editor/widgets/toolbarWidgets/currentStyle",
@@ -42,7 +43,7 @@ define("webodf/editor/Tools", [
4243
"webodf/editor/widgets/zoomSlider",
4344
"webodf/editor/widgets/aboutDialog",
4445
"webodf/editor/EditorSession"],
45-
function (ready, MenuItem, DropDownMenu, Button, DropDownButton, Toolbar, ParagraphAlignment, SimpleStyles, UndoRedoMenu, CurrentStyle, AnnotationControl, EditHyperlinks, ImageInserter, ParagraphStylesDialog, ZoomSlider, AboutDialog, EditorSession) {
46+
function (ready, MenuItem, DropDownMenu, Button, DropDownButton, Toolbar, ParagraphAlignment, ToggleLists, SimpleStyles, UndoRedoMenu, CurrentStyle, AnnotationControl, EditHyperlinks, ImageInserter, ParagraphStylesDialog, ZoomSlider, AboutDialog, EditorSession) {
4647
"use strict";
4748

4849
return function Tools(toolbarElementId, args) {
@@ -59,6 +60,7 @@ define("webodf/editor/Tools", [
5960
undoRedoMenu,
6061
editorSession,
6162
paragraphAlignment,
63+
toggleLists,
6264
imageInserter,
6365
annotationControl,
6466
editHyperlinks,
@@ -171,6 +173,9 @@ define("webodf/editor/Tools", [
171173
// Paragraph direct alignment buttons
172174
paragraphAlignment = createTool(ParagraphAlignment, args.directParagraphStylingEnabled);
173175

176+
// Numbered and bulleted list toggle buttons
177+
toggleLists = createTool(ToggleLists, true);
178+
174179
// Paragraph Style Selector
175180
currentStyle = createTool(CurrentStyle, args.paragraphStyleSelectingEnabled);
176181

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* Copyright (C) 2010-2014 KO GmbH <copyright@kogmbh.com>
3+
*
4+
* @licstart
5+
* This file is part of WebODF.
6+
*
7+
* WebODF is free software: you can redistribute it and/or modify it
8+
* under the terms of the GNU Affero General Public License (GNU AGPL)
9+
* as published by the Free Software Foundation, either version 3 of
10+
* the License, or (at your option) any later version.
11+
*
12+
* WebODF is distributed in the hope that it will be useful, but
13+
* WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License
18+
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
19+
* @licend
20+
*
21+
* @source: http://www.webodf.org/
22+
* @source: https://github.com/kogmbh/WebODF/
23+
*/
24+
25+
/*global define,require */
26+
27+
define("webodf/editor/widgets/toggleLists", [
28+
"dijit/form/ToggleButton",
29+
"webodf/editor/EditorSession"],
30+
31+
function (ToggleButton, EditorSession) {
32+
"use strict";
33+
34+
var ToggleLists = function (callback) {
35+
var self = this,
36+
editorSession,
37+
widget = {},
38+
numberedList,
39+
bulletedList;
40+
41+
numberedList = new ToggleButton({
42+
label: runtime.tr('Numbering'),
43+
disabled: true,
44+
showLabel: false,
45+
checked: false,
46+
iconClass: "dijitEditorIcon dijitEditorIconInsertOrderedList",
47+
onChange: function () {
48+
}
49+
});
50+
51+
bulletedList = new ToggleButton({
52+
label: runtime.tr('Bullets'),
53+
disabled: true,
54+
showLabel: false,
55+
checked: false,
56+
iconClass: "dijitEditorIcon dijitEditorIconInsertUnorderedList",
57+
onChange: function () {
58+
}
59+
});
60+
61+
widget.children = [numberedList, bulletedList];
62+
63+
widget.startup = function () {
64+
widget.children.forEach(function (element) {
65+
element.startup();
66+
});
67+
};
68+
69+
widget.placeAt = function (container) {
70+
widget.children.forEach(function (element) {
71+
element.placeAt(container);
72+
});
73+
return widget;
74+
};
75+
76+
this.onToolDone = function () {
77+
};
78+
79+
this.setEditorSession = function (session) {
80+
};
81+
82+
callback(widget);
83+
};
84+
85+
return ToggleLists;
86+
}
87+
);

0 commit comments

Comments
 (0)