rwiki 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Capfile +2 -0
- data/Gemfile +30 -0
- data/Rakefile +22 -65
- data/VERSION +1 -1
- data/config.ru +11 -0
- data/config/config.yml.example +1 -0
- data/config/deploy.rb +37 -0
- data/features/create_page.feature +30 -20
- data/features/delete_page.feature +23 -18
- data/features/display_page.feature +10 -11
- data/features/editor.feature +45 -0
- data/features/history.feature +46 -0
- data/features/rename_page.feature +42 -37
- data/features/step_definitions/common_steps.rb +19 -47
- data/features/step_definitions/common_transforms.rb +5 -0
- data/features/step_definitions/dialog_box_steps.rb +16 -0
- data/features/step_definitions/history_steps.rb +11 -0
- data/features/step_definitions/tab_panel_steps.rb +27 -0
- data/features/step_definitions/tree_panel_steps.rb +42 -0
- data/features/step_definitions/wait_steps.rb +21 -0
- data/features/support/env.rb +6 -0
- data/features/tab_panel.feature +47 -0
- data/features/tree_panel.feature +14 -15
- data/lib/rwiki.rb +1 -0
- data/lib/rwiki/app.rb +14 -2
- data/lib/rwiki/models/folder.rb +1 -1
- data/lib/rwiki/models/node.rb +11 -1
- data/lib/rwiki/models/page.rb +1 -1
- data/public/favicon.ico +0 -0
- data/public/images/compressed.png +0 -0
- data/public/images/css.png +0 -0
- data/public/images/file.png +0 -0
- data/public/images/html.png +0 -0
- data/public/images/icon_word.png +0 -0
- data/public/images/image.png +0 -0
- data/public/images/javascript.png +0 -0
- data/public/images/pdf.png +0 -0
- data/public/images/php.png +0 -0
- data/public/images/presentation.png +0 -0
- data/public/images/ruby.png +0 -0
- data/public/images/shellscript.png +0 -0
- data/public/images/stylesheet.png +0 -0
- data/public/images/text.png +0 -0
- data/public/images/wordprocessing.png +0 -0
- data/public/javascripts/Rwiki.js +71 -29
- data/public/javascripts/Rwiki/EditorPanel.js +5 -37
- data/public/javascripts/Rwiki/EditorPanel/Editor.js +8 -44
- data/public/javascripts/Rwiki/EditorWindow.js +66 -0
- data/public/javascripts/Rwiki/FuzzyFinderDialog.js +61 -0
- data/public/javascripts/Rwiki/NavigationPanel.js +25 -0
- data/public/javascripts/Rwiki/NodeManager.js +2 -0
- data/public/javascripts/Rwiki/TabPanel.js +39 -2
- data/public/javascripts/Rwiki/TreePanel.js +39 -26
- data/public/javascripts/Rwiki/TreePanel/Menu.js +1 -1
- data/public/javascripts/Rwiki/TreePanel/Node.js +46 -0
- data/public/javascripts/vendor/ext/adapter/ext/ext-base-debug.js +836 -710
- data/public/javascripts/vendor/ext/adapter/ext/ext-base.js +5 -5
- data/public/javascripts/vendor/ext/adapter/jquery/ext-jquery-adapter-debug.js +47 -700
- data/public/javascripts/vendor/ext/adapter/jquery/ext-jquery-adapter.js +5 -5
- data/public/javascripts/vendor/ext/adapter/prototype/ext-prototype-adapter-debug.js +45 -698
- data/public/javascripts/vendor/ext/adapter/prototype/ext-prototype-adapter.js +5 -5
- data/public/javascripts/vendor/ext/adapter/yui/ext-yui-adapter-debug.js +39 -696
- data/public/javascripts/vendor/ext/adapter/yui/ext-yui-adapter.js +5 -5
- data/public/javascripts/vendor/ext/ext-all-debug-w-comments.js +17932 -12860
- data/public/javascripts/vendor/ext/ext-all-debug.js +11674 -8102
- data/public/javascripts/vendor/ext/ext-all.js +6 -6
- data/public/javascripts/vendor/ext/ux/StatusBar.js +418 -0
- data/public/resources/ext/charts.swf +0 -0
- data/public/resources/ext/css/debug.css +4 -4
- data/public/resources/ext/css/ext-all-notheme.css +204 -52
- data/public/resources/ext/css/ext-all.css +234 -54
- data/public/resources/ext/css/reset-min.css +4 -4
- data/public/resources/ext/css/structure/borders.css +4 -4
- data/public/resources/ext/css/structure/box.css +4 -4
- data/public/resources/ext/css/structure/button.css +7 -7
- data/public/resources/ext/css/structure/combo.css +4 -4
- data/public/resources/ext/css/structure/core.css +15 -5
- data/public/resources/ext/css/structure/date-picker.css +4 -4
- data/public/resources/ext/css/structure/dd.css +4 -4
- data/public/resources/ext/css/structure/debug.css +4 -4
- data/public/resources/ext/css/structure/dialog.css +6 -9
- data/public/resources/ext/css/structure/editor.css +4 -4
- data/public/resources/ext/css/structure/form.css +14 -4
- data/public/resources/ext/css/structure/grid.css +15 -5
- data/public/resources/ext/css/structure/layout.css +7 -7
- data/public/resources/ext/css/structure/list-view.css +4 -4
- data/public/resources/ext/css/structure/menu.css +13 -6
- data/public/resources/ext/css/structure/panel-reset.css +4 -4
- data/public/resources/ext/css/structure/panel.css +70 -22
- data/public/resources/ext/css/structure/pivotgrid.css +65 -0
- data/public/resources/ext/css/structure/progress.css +4 -4
- data/public/resources/ext/css/structure/qtips.css +4 -4
- data/public/resources/ext/css/structure/reset.css +11 -5
- data/public/resources/ext/css/structure/resizable.css +4 -4
- data/public/resources/ext/css/structure/slider.css +4 -4
- data/public/resources/ext/css/structure/tabs.css +13 -8
- data/public/resources/ext/css/structure/toolbar.css +5 -5
- data/public/resources/ext/css/structure/tree.css +11 -11
- data/public/resources/ext/css/structure/window.css +5 -5
- data/public/resources/ext/css/theme-access/borders.css +4 -4
- data/public/resources/ext/css/theme-access/box.css +4 -4
- data/public/resources/ext/css/theme-access/button.css +4 -4
- data/public/resources/ext/css/theme-access/combo.css +4 -4
- data/public/resources/ext/css/theme-access/core.css +4 -4
- data/public/resources/ext/css/theme-access/date-picker.css +4 -4
- data/public/resources/ext/css/theme-access/dd.css +4 -4
- data/public/resources/ext/css/theme-access/debug.css +4 -4
- data/public/resources/ext/css/theme-access/dialog.css +4 -4
- data/public/resources/ext/css/theme-access/editor.css +4 -4
- data/public/resources/ext/css/theme-access/form.css +4 -4
- data/public/resources/ext/css/theme-access/grid.css +4 -4
- data/public/resources/ext/css/theme-access/layout.css +4 -4
- data/public/resources/ext/css/theme-access/list-view.css +8 -4
- data/public/resources/ext/css/theme-access/menu.css +4 -4
- data/public/resources/ext/css/theme-access/panel.css +4 -4
- data/public/resources/ext/css/theme-access/progress.css +4 -4
- data/public/resources/ext/css/theme-access/qtips.css +4 -4
- data/public/resources/ext/css/theme-access/resizable.css +4 -4
- data/public/resources/ext/css/theme-access/slider.css +4 -4
- data/public/resources/ext/css/theme-access/tabs.css +4 -4
- data/public/resources/ext/css/theme-access/toolbar.css +4 -4
- data/public/resources/ext/css/theme-access/tree.css +4 -4
- data/public/resources/ext/css/theme-access/window.css +5 -5
- data/public/resources/ext/css/theme-gray/borders.css +4 -4
- data/public/resources/ext/css/theme-gray/box.css +4 -4
- data/public/resources/ext/css/theme-gray/button.css +4 -4
- data/public/resources/ext/css/theme-gray/combo.css +4 -4
- data/public/resources/ext/css/theme-gray/core.css +6 -4
- data/public/resources/ext/css/theme-gray/date-picker.css +4 -4
- data/public/resources/ext/css/theme-gray/dd.css +4 -4
- data/public/resources/ext/css/theme-gray/debug.css +4 -4
- data/public/resources/ext/css/theme-gray/dialog.css +4 -4
- data/public/resources/ext/css/theme-gray/editor.css +4 -4
- data/public/resources/ext/css/theme-gray/form.css +4 -4
- data/public/resources/ext/css/theme-gray/grid.css +10 -6
- data/public/resources/ext/css/theme-gray/layout.css +4 -4
- data/public/resources/ext/css/theme-gray/list-view.css +5 -5
- data/public/resources/ext/css/theme-gray/menu.css +4 -4
- data/public/resources/ext/css/theme-gray/panel.css +4 -4
- data/public/resources/ext/css/theme-gray/pivotgrid.css +28 -0
- data/public/resources/ext/css/theme-gray/progress.css +4 -4
- data/public/resources/ext/css/theme-gray/qtips.css +4 -4
- data/public/resources/ext/css/theme-gray/resizable.css +4 -4
- data/public/resources/ext/css/theme-gray/slider.css +4 -4
- data/public/resources/ext/css/theme-gray/tabs.css +4 -4
- data/public/resources/ext/css/theme-gray/toolbar.css +4 -4
- data/public/resources/ext/css/theme-gray/tree.css +4 -4
- data/public/resources/ext/css/theme-gray/window.css +4 -4
- data/public/resources/ext/css/visual/borders.css +4 -4
- data/public/resources/ext/css/visual/box.css +4 -4
- data/public/resources/ext/css/visual/button.css +4 -4
- data/public/resources/ext/css/visual/combo.css +4 -4
- data/public/resources/ext/css/visual/core.css +6 -4
- data/public/resources/ext/css/visual/date-picker.css +4 -4
- data/public/resources/ext/css/visual/dd.css +4 -4
- data/public/resources/ext/css/visual/debug.css +4 -4
- data/public/resources/ext/css/visual/dialog.css +4 -4
- data/public/resources/ext/css/visual/editor.css +4 -4
- data/public/resources/ext/css/visual/form.css +4 -4
- data/public/resources/ext/css/visual/grid.css +8 -4
- data/public/resources/ext/css/visual/layout.css +4 -4
- data/public/resources/ext/css/visual/list-view.css +4 -4
- data/public/resources/ext/css/visual/menu.css +4 -4
- data/public/resources/ext/css/visual/panel.css +4 -4
- data/public/resources/ext/css/visual/pivotgrid.css +28 -0
- data/public/resources/ext/css/visual/progress.css +4 -4
- data/public/resources/ext/css/visual/qtips.css +4 -4
- data/public/resources/ext/css/visual/resizable.css +4 -4
- data/public/resources/ext/css/visual/slider.css +4 -4
- data/public/resources/ext/css/visual/tabs.css +4 -4
- data/public/resources/ext/css/visual/toolbar.css +5 -5
- data/public/resources/ext/css/visual/tree.css +4 -4
- data/public/resources/ext/css/visual/window.css +4 -4
- data/public/resources/ext/css/xtheme-access.css +9 -5
- data/public/resources/ext/css/xtheme-blue.css +34 -6
- data/public/resources/ext/css/xtheme-gray.css +35 -7
- data/public/resources/ext/css/yourtheme.css +11 -5
- data/public/resources/ext/images/access/panel/tool-sprites.gif +0 -0
- data/public/resources/ext/images/default/grid/grid3-rowheader.gif +0 -0
- data/public/resources/ext/images/default/grid/refresh-disabled.gif +0 -0
- data/public/resources/ext/images/default/panel/tool-sprites.gif +0 -0
- data/public/resources/ext/images/gray/grid/sort-hd.gif +0 -0
- data/public/resources/ext/images/gray/panel/tool-sprites.gif +0 -0
- data/public/resources/ext/images/gray/window/left-corners.png +0 -0
- data/public/resources/ext/images/gray/window/left-right.png +0 -0
- data/public/resources/ext/images/gray/window/right-corners.png +0 -0
- data/public/resources/ext/images/gray/window/top-bottom.png +0 -0
- data/public/stylesheets/coderay.css +3 -0
- data/public/stylesheets/markitup.css +19 -0
- data/public/stylesheets/style.css +1 -1
- data/run_tests.sh +1 -0
- data/rwiki.gemspec +56 -37
- data/test/fixtures/pages/Info/dummy +0 -0
- data/test/rwiki/models/test_folder.rb +4 -4
- data/vendor/.gitkeep +0 -0
- data/views/layout.erb +13 -5
- metadata +78 -69
- data/.idea/projectCodeStyle.xml +0 -80
- data/.rvmrc +0 -1
- data/public/javascripts/Rwiki/SidePanel.js +0 -26
- data/public/javascripts/Rwiki/Toolbar.js +0 -31
- data/public/javascripts/Rwiki/Viewport.js +0 -10
- data/tmp/ExtDesigner/MyViewport.js +0 -18
- data/tmp/ExtDesigner/MyViewport.ui.js +0 -29
- data/tmp/ExtDesigner/Rwiki.EditorPanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.EditorPanel.ui.js +0 -27
- data/tmp/ExtDesigner/Rwiki.MainPanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.MainPanel.ui.js +0 -29
- data/tmp/ExtDesigner/Rwiki.TabPane.PageTab.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TabPane.PageTab.ui.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TabPanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TabPanel.ui.js +0 -27
- data/tmp/ExtDesigner/Rwiki.TreePanel.js +0 -19
- data/tmp/ExtDesigner/Rwiki.TreePanel.ui.js +0 -27
- data/tmp/ExtDesigner/Rwiki.Viewport.js +0 -18
- data/tmp/ExtDesigner/Rwiki.Viewport.ui.js +0 -30
- data/tmp/ExtDesigner/rwiki.xds +0 -192
- data/tmp/ExtDesigner/xds_includeOrder.txt +0 -12
- data/tmp/ExtDesigner/xds_index.html +0 -26
- data/tmp/ExtDesigner/xds_index.js +0 -19
data/lib/rwiki.rb
CHANGED
data/lib/rwiki/app.rb
CHANGED
|
@@ -2,10 +2,12 @@ module Rwiki
|
|
|
2
2
|
class App < Sinatra::Base
|
|
3
3
|
include Models
|
|
4
4
|
|
|
5
|
-
set :raise_errors, false
|
|
6
|
-
set :show_exceptions, false
|
|
7
5
|
set :root, File.join(File.dirname(__FILE__), '../..')
|
|
8
6
|
|
|
7
|
+
disable :raise_errors
|
|
8
|
+
disable :show_exceptions
|
|
9
|
+
disable :logging
|
|
10
|
+
|
|
9
11
|
error NodeNotFoundError do
|
|
10
12
|
message = request.env['sinatra.error'].message
|
|
11
13
|
{ :success => false, :message => message }.to_json
|
|
@@ -55,6 +57,7 @@ module Rwiki
|
|
|
55
57
|
|
|
56
58
|
result = node.to_hash
|
|
57
59
|
result[:parentPath] = parent_folder.path
|
|
60
|
+
|
|
58
61
|
result.to_json
|
|
59
62
|
end
|
|
60
63
|
|
|
@@ -67,6 +70,7 @@ module Rwiki
|
|
|
67
70
|
|
|
68
71
|
result = node.to_hash
|
|
69
72
|
result[:oldPath] = path
|
|
73
|
+
|
|
70
74
|
result.to_json
|
|
71
75
|
end
|
|
72
76
|
|
|
@@ -81,6 +85,7 @@ module Rwiki
|
|
|
81
85
|
result = node.to_hash
|
|
82
86
|
result[:oldPath] = path
|
|
83
87
|
result[:success] = true
|
|
88
|
+
|
|
84
89
|
result.to_json
|
|
85
90
|
end
|
|
86
91
|
|
|
@@ -91,5 +96,12 @@ module Rwiki
|
|
|
91
96
|
|
|
92
97
|
{ :path => node.path }.to_json
|
|
93
98
|
end
|
|
99
|
+
|
|
100
|
+
get '/fuzzy_finder' do
|
|
101
|
+
query = params[:query]
|
|
102
|
+
matches = Node.fuzzy_finder(query)
|
|
103
|
+
|
|
104
|
+
{ :results => matches, :count => matches.size }.to_json
|
|
105
|
+
end
|
|
94
106
|
end
|
|
95
107
|
end
|
data/lib/rwiki/models/folder.rb
CHANGED
|
@@ -28,7 +28,7 @@ module Rwiki::Models
|
|
|
28
28
|
new_page_full_path = self.class.full_path_for(new_page_path)
|
|
29
29
|
raise Rwiki::NodeError.new("#{new_page_path} already exists") if File.exists?(new_page_full_path)
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
File.open(new_page_full_path, 'w') { |f| f.write("h1. #{name.gsub(/\.txt$/, '')}\n\n") }
|
|
32
32
|
return Page.new(new_page_path)
|
|
33
33
|
end
|
|
34
34
|
|
data/lib/rwiki/models/node.rb
CHANGED
|
@@ -15,6 +15,16 @@ module Rwiki::Models
|
|
|
15
15
|
def working_path=(path)
|
|
16
16
|
@@working_path = path
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
def fuzzy_finder(query)
|
|
20
|
+
@finder ||= FuzzyFileFinder.new(full_path_for('.'))
|
|
21
|
+
matches = @finder.find(query).sort_by { |m| [-m[:score], m[:path]] }
|
|
22
|
+
matches.each do |m|
|
|
23
|
+
m[:path] = '.' + m[:path].gsub(full_path_for('.'), '')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
return matches
|
|
27
|
+
end
|
|
18
28
|
end
|
|
19
29
|
|
|
20
30
|
def self.new_from_path(path)
|
|
@@ -32,7 +42,7 @@ module Rwiki::Models
|
|
|
32
42
|
end
|
|
33
43
|
|
|
34
44
|
def parent_folder
|
|
35
|
-
|
|
45
|
+
Folder.new(File.dirname(@path))
|
|
36
46
|
end
|
|
37
47
|
|
|
38
48
|
def delete
|
data/lib/rwiki/models/page.rb
CHANGED
|
@@ -65,7 +65,7 @@ module Rwiki::Models
|
|
|
65
65
|
@raw_content = raw_content.gsub(CODE_REGEXP) do
|
|
66
66
|
code = $3 || ''
|
|
67
67
|
lang = $2
|
|
68
|
-
"<notextile>#{CodeRay.scan(code.strip, lang).html
|
|
68
|
+
"<notextile>#{CodeRay.scan(code.strip, lang).html.div(:css => :class)}</notextile>"
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
data/public/favicon.ico
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/public/javascripts/Rwiki.js
CHANGED
|
@@ -14,58 +14,100 @@ Rwiki.captureEvents = function(observable) {
|
|
|
14
14
|
|
|
15
15
|
Rwiki.init = function() {
|
|
16
16
|
|
|
17
|
+
// TabPanel history
|
|
18
|
+
Ext.History.init();
|
|
19
|
+
|
|
20
|
+
var firstLoad = true;
|
|
21
|
+
|
|
17
22
|
// TODO find better solution
|
|
18
|
-
Rwiki.
|
|
19
|
-
|
|
20
|
-
Rwiki.ajaxCallInProgress = true;
|
|
21
|
-
}).ajaxStop(function() {
|
|
22
|
-
Rwiki.ajaxCallInProgress = false;
|
|
23
|
-
});
|
|
23
|
+
Rwiki.ajaxCallCompleted = true;
|
|
24
|
+
Rwiki.treeLoaded = false;
|
|
24
25
|
|
|
25
|
-
var toolbar = new Rwiki.Toolbar();
|
|
26
26
|
var treePanel = new Rwiki.TreePanel();
|
|
27
27
|
Rwiki.treePanel = treePanel;
|
|
28
|
-
var treePanelContextMenu = new Rwiki.TreePanel.Menu();
|
|
29
|
-
treePanel.setContextMenu(treePanelContextMenu);
|
|
30
28
|
var nodeManager = Rwiki.NodeManager.getInstance();
|
|
31
29
|
|
|
30
|
+
nodeManager.on('rwiki:beforePageLoad', function() {
|
|
31
|
+
Rwiki.ajaxCallCompleted = false;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
nodeManager.on('rwiki:pageLoaded', function() {
|
|
35
|
+
Rwiki.ajaxCallCompleted = true;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
treePanel.getLoader().on('load', function() {
|
|
39
|
+
Rwiki.treeLoaded = true;
|
|
40
|
+
Rwiki.treePanel.openNodeFromLocationHash();
|
|
41
|
+
});
|
|
42
|
+
|
|
32
43
|
treePanel.relayEvents(nodeManager,
|
|
33
|
-
['rwiki:folderCreated', 'rwiki:pageCreated', 'rwiki:nodeRenamed', 'rwiki:nodeDeleted']);
|
|
44
|
+
['rwiki:pageLoaded', 'rwiki:folderCreated', 'rwiki:pageCreated', 'rwiki:nodeRenamed', 'rwiki:nodeDeleted']);
|
|
34
45
|
|
|
35
46
|
var tabPanel = new Rwiki.TabPanel();
|
|
47
|
+
Rwiki.tabPanel = tabPanel;
|
|
36
48
|
tabPanel.relayEvents(nodeManager,
|
|
37
49
|
['rwiki:pageLoaded', 'rwiki:folderCreated', 'rwiki:pageCreated', 'rwiki:pageSaved', 'rwiki:nodeRenamed', 'rwiki:nodeDeleted']);
|
|
38
50
|
tabPanel.relayEvents(treePanel, ['pageSelected']);
|
|
39
51
|
|
|
40
52
|
var editorPanel = new Rwiki.EditorPanel();
|
|
41
|
-
editorPanel.relayEvents(
|
|
42
|
-
['rwiki:pageLoaded', 'rwiki:nodeRenamed', 'rwiki:nodeDeleted', 'rwiki:lastPageClosed']);
|
|
43
|
-
editorPanel.relayEvents(toolbar, ['editorToggled']);
|
|
53
|
+
editorPanel.relayEvents(Rwiki.NodeManager.getInstance(), ['rwiki:pageLoaded']);
|
|
44
54
|
|
|
45
|
-
|
|
55
|
+
var window = new Rwiki.EditorWindow(editorPanel);
|
|
46
56
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
function showEditor(path) {
|
|
58
|
+
if (!window.isVisible()) {
|
|
59
|
+
window.setPagePath(path);
|
|
60
|
+
window.show();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
50
63
|
|
|
51
|
-
|
|
64
|
+
tabPanel.on('rwiki:editPage', function(path) {
|
|
65
|
+
showEditor(path);
|
|
66
|
+
});
|
|
52
67
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
items: [tabPanel, editorPanel]
|
|
68
|
+
// Handle this change event in order to restore the UI to the appropriate history state
|
|
69
|
+
Ext.History.on('change', function() {
|
|
70
|
+
Rwiki.treePanel.openNodeFromLocationHash();
|
|
57
71
|
});
|
|
58
72
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
items: [sidePanel, pageAndEditorPanel]
|
|
73
|
+
// Create layout
|
|
74
|
+
|
|
75
|
+
var navigationPanel = new Rwiki.NavigationPanel({
|
|
76
|
+
items: [treePanel]
|
|
64
77
|
});
|
|
65
78
|
|
|
66
|
-
var app = new
|
|
67
|
-
|
|
79
|
+
var app = new Ext.Viewport({
|
|
80
|
+
layout: 'border',
|
|
81
|
+
plain: true,
|
|
82
|
+
renderTo: Ext.getBody(),
|
|
83
|
+
items: [navigationPanel, tabPanel]
|
|
68
84
|
});
|
|
69
85
|
|
|
70
86
|
app.show();
|
|
87
|
+
|
|
88
|
+
// map one key by key code
|
|
89
|
+
var map = new Ext.KeyMap(document, [{
|
|
90
|
+
key: "e",
|
|
91
|
+
alt: true,
|
|
92
|
+
stopEvent: true,
|
|
93
|
+
fn: function() {
|
|
94
|
+
tabPanel.onEditPage();
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "t",
|
|
98
|
+
ctrl: true,
|
|
99
|
+
stopEvent: true,
|
|
100
|
+
fn: function() {
|
|
101
|
+
tabPanel.onFuzzyFinder();
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "w",
|
|
105
|
+
ctrl: true,
|
|
106
|
+
stopEvent: true,
|
|
107
|
+
fn: function() {
|
|
108
|
+
var tab = tabPanel.getActiveTab();
|
|
109
|
+
tabPanel.remove(tab);
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
|
|
71
113
|
};
|
|
@@ -3,13 +3,8 @@ Ext.ns('Rwiki');
|
|
|
3
3
|
Rwiki.EditorPanel = Ext.extend(Ext.Panel, {
|
|
4
4
|
constructor: function() {
|
|
5
5
|
Ext.apply(this, {
|
|
6
|
-
region: 'east',
|
|
7
6
|
contentEl: 'editor-container',
|
|
8
7
|
header: false,
|
|
9
|
-
collapseMode: 'mini',
|
|
10
|
-
split: true,
|
|
11
|
-
collapsible: true,
|
|
12
|
-
collapsed: true,
|
|
13
8
|
height: 400,
|
|
14
9
|
|
|
15
10
|
listeners: {
|
|
@@ -23,17 +18,13 @@ Rwiki.EditorPanel = Ext.extend(Ext.Panel, {
|
|
|
23
18
|
});
|
|
24
19
|
|
|
25
20
|
Rwiki.EditorPanel.superclass.constructor.apply(this, arguments);
|
|
26
|
-
this.editor = new Rwiki.EditorPanel.Editor(
|
|
21
|
+
this.editor = new Rwiki.EditorPanel.Editor();
|
|
27
22
|
},
|
|
28
23
|
|
|
29
24
|
initEvents: function() {
|
|
30
25
|
Rwiki.EditorPanel.superclass.initEvents.apply(this, arguments);
|
|
31
26
|
|
|
32
27
|
this.on('rwiki:pageLoaded', this.onPageLoaded);
|
|
33
|
-
this.on('rwiki:nodeRenamed', this.onNodeRenamed);
|
|
34
|
-
this.on('rwiki:nodeDeleted', this.onNodeDeleted);
|
|
35
|
-
this.on('rwiki:lastPageClosed', this.onLastPageClosed);
|
|
36
|
-
this.on('editorToggled', this.onEditorToggled);
|
|
37
28
|
},
|
|
38
29
|
|
|
39
30
|
onPageLoaded: function(data) {
|
|
@@ -41,34 +32,11 @@ Rwiki.EditorPanel = Ext.extend(Ext.Panel, {
|
|
|
41
32
|
this.editor.setContent(data.rawContent);
|
|
42
33
|
},
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var currentPagePath = this.editor.getPagePath();
|
|
47
|
-
if (currentPagePath == null) return;
|
|
48
|
-
|
|
49
|
-
var isPage = oldPath.match(new RegExp('\.txt$'));
|
|
50
|
-
var currentPageWasChanged = isPage && oldPath == currentPagePath;
|
|
51
|
-
var parentPathWasChanged = Rwiki.NodeManager.getInstance().isParent(oldPath, currentPagePath);
|
|
52
|
-
|
|
53
|
-
if (currentPageWasChanged) {
|
|
54
|
-
this.editor.setPagePath(data.path);
|
|
55
|
-
} else if (parentPathWasChanged) {
|
|
56
|
-
var newPath = currentPagePath.replace(oldPath, data.path);
|
|
57
|
-
this.editor.setPagePath(newPath);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
onNodeDeleted: function(data) {
|
|
62
|
-
if (data.path == this.editor.getPagePath()) {
|
|
63
|
-
this.editor.clearContent();
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
onLastPageClosed: function() {
|
|
68
|
-
this.editor.clearContent();
|
|
35
|
+
getPagePath: function() {
|
|
36
|
+
return this.editor.getPagePath();
|
|
69
37
|
},
|
|
70
38
|
|
|
71
|
-
|
|
72
|
-
this.
|
|
39
|
+
getRawContent: function() {
|
|
40
|
+
return this.editor.getContent();
|
|
73
41
|
}
|
|
74
42
|
});
|
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
Ext.ns('Rwiki.EditorPanel');
|
|
2
2
|
|
|
3
3
|
Rwiki.EditorPanel.Editor = Ext.extend(Ext.util.Observable, {
|
|
4
|
-
constructor: function(
|
|
4
|
+
constructor: function() {
|
|
5
5
|
Rwiki.EditorPanel.Editor.superclass.constructor.apply(this, arguments);
|
|
6
|
-
|
|
7
|
-
this.container = container;
|
|
8
|
-
this.enabled = false;
|
|
9
|
-
|
|
10
|
-
// hack for FF, clear text area on load
|
|
11
|
-
this.container.val('');
|
|
12
|
-
|
|
6
|
+
this.container = $('textarea#editor');
|
|
13
7
|
this.initMarkItUp();
|
|
14
|
-
this.initEvents();
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
initEvents: function() {
|
|
18
|
-
var self = this;
|
|
19
|
-
|
|
20
|
-
this.container.bind('keydown', function() {
|
|
21
|
-
return self.enabled;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
var timeout = null;
|
|
25
|
-
this.container.bind('keyup', function() {
|
|
26
|
-
if (!self.enabled) return;
|
|
27
|
-
|
|
28
|
-
clearTimeout(timeout);
|
|
29
|
-
var callback = function() {
|
|
30
|
-
self.savePage();
|
|
31
|
-
};
|
|
32
|
-
timeout = setTimeout(callback, 500);
|
|
33
|
-
});
|
|
34
8
|
},
|
|
35
9
|
|
|
36
10
|
initMarkItUp: function() {
|
|
@@ -60,28 +34,18 @@ Rwiki.EditorPanel.Editor = Ext.extend(Ext.util.Observable, {
|
|
|
60
34
|
{separator:'---------------' },
|
|
61
35
|
{name:'Quotes', openWith:'bq(!(([![Class]!]))!). '},
|
|
62
36
|
{separator:'---------------' },
|
|
63
|
-
{name:'Code', openWith:'<code>\n', closeWith:'\n</code>'},
|
|
64
|
-
{name:'Ruby Code', openWith:'<code lang="ruby">\n', closeWith:'\n</code>'},
|
|
65
|
-
{name:'JavaScript Code', openWith:'<code lang="javascript">\n', closeWith:'\n</code>'},
|
|
66
|
-
{name:'HTML Code', openWith:'<code lang="html">\n', closeWith:'\n</code>'},
|
|
67
|
-
{name:'Css Code', openWith:'<code lang="css">\n', closeWith:'\n</code>'}
|
|
37
|
+
{name:'Code', openWith:'<code>\n', closeWith:'\n</code>', className: 'insert-code'},
|
|
38
|
+
{name:'Ruby Code', openWith:'<code lang="ruby">\n', closeWith:'\n</code>', className: 'insert-code ruby'},
|
|
39
|
+
{name:'JavaScript Code', openWith:'<code lang="javascript">\n', closeWith:'\n</code>', className: 'insert-code javascript'},
|
|
40
|
+
{name:'HTML Code', openWith:'<code lang="html">\n', closeWith:'\n</code>', className: 'insert-code html'},
|
|
41
|
+
{name:'Css Code', openWith:'<code lang="css">\n', closeWith:'\n</code>', className: 'insert-code css'}
|
|
68
42
|
],
|
|
69
|
-
resizeHandle: false
|
|
70
|
-
afterInsert: function() {
|
|
71
|
-
self.savePage();
|
|
72
|
-
}
|
|
43
|
+
resizeHandle: false
|
|
73
44
|
};
|
|
74
45
|
|
|
75
46
|
this.container.markItUp(textileSettings);
|
|
76
47
|
},
|
|
77
48
|
|
|
78
|
-
savePage: function() {
|
|
79
|
-
var path = this.getPagePath();
|
|
80
|
-
var rawContent = this.getContent();
|
|
81
|
-
|
|
82
|
-
Rwiki.NodeManager.getInstance().savePage(path, rawContent);
|
|
83
|
-
},
|
|
84
|
-
|
|
85
49
|
clearContent: function() {
|
|
86
50
|
this.container.val('');
|
|
87
51
|
this.disable();
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Ext.ns('Rwiki');
|
|
2
|
+
|
|
3
|
+
Rwiki.EditorWindow = Ext.extend(Ext.Window, {
|
|
4
|
+
constructor: function(editorPanel) {
|
|
5
|
+
Ext.apply(this, {
|
|
6
|
+
maximizable: true,
|
|
7
|
+
modal: true,
|
|
8
|
+
width: 750,
|
|
9
|
+
height: 500,
|
|
10
|
+
minWidth: 300,
|
|
11
|
+
minHeight: 200,
|
|
12
|
+
layout: 'fit',
|
|
13
|
+
plain: true,
|
|
14
|
+
bodyStyle: 'padding: 5px;',
|
|
15
|
+
buttonAlign: 'center',
|
|
16
|
+
items: editorPanel,
|
|
17
|
+
buttons: [
|
|
18
|
+
{
|
|
19
|
+
text: 'Save',
|
|
20
|
+
scope: this,
|
|
21
|
+
handler: this.onSaveButton
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
text: 'Save and continue',
|
|
25
|
+
scope: this,
|
|
26
|
+
handler: this.onSaveAndContinueButton
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
text: 'Cancel',
|
|
30
|
+
scope: this,
|
|
31
|
+
handler: this.onCancelButton
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
Rwiki.EditorWindow.superclass.constructor.apply(this, arguments);
|
|
37
|
+
this.editorPanel = editorPanel;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
setPagePath: function(path) {
|
|
41
|
+
this.pagePath = path;
|
|
42
|
+
this.setTitle('Editing page ' + path);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
show: function() {
|
|
46
|
+
Rwiki.NodeManager.getInstance().loadPage(this.pagePath);
|
|
47
|
+
Rwiki.EditorWindow.superclass.show.apply(this, arguments);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
onSaveButton: function() {
|
|
51
|
+
Rwiki.NodeManager.getInstance().savePage(this.pagePath, this.editorPanel.getRawContent());
|
|
52
|
+
this.hide();
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
onSaveAndContinueButton: function() {
|
|
56
|
+
Rwiki.NodeManager.getInstance().savePage(this.pagePath, this.editorPanel.getRawContent());
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
onCancelButton: function() {
|
|
60
|
+
this.hide();
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
close: function() {
|
|
64
|
+
this.hide();
|
|
65
|
+
}
|
|
66
|
+
});
|