mbeditor 0.5.4 → 0.5.5
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +30 -0
- data/app/assets/javascripts/mbeditor/search_service.js +1 -0
- data/app/controllers/mbeditor/editors_controller.rb +8 -3
- data/app/views/layouts/mbeditor/application.html.erb +2 -2
- data/lib/mbeditor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 041ce3cd1e0cc69e9c9d4fbf4a3578d8681ce4ed54cbaf6351f36e4642d161b9
|
|
4
|
+
data.tar.gz: e65f221f2bad0d72957225ba5836104878e27865c4e86b82b45857509922d571
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f51620ece5851894a862bc5ed080bb0a4d73a4263a987b069b212ed15d705f3a2ce1383dcb6850578bd2bb6f1aa5a00734132d11ab62cf91cfb945cf8042a5d
|
|
7
|
+
data.tar.gz: da12cdf3ddceaf8d91f173ca11df458e88f4c294294eef005401a6b2ecc3457d5d76f4ce9bb148d6fbd18e572a0b669f154ef4675855ebb170fe63859aef82dd
|
|
@@ -1740,6 +1740,29 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
1740
1740
|
EditorStore.setStatus('Line endings changed to ' + newEOL, 'info');
|
|
1741
1741
|
};
|
|
1742
1742
|
|
|
1743
|
+
var handleRefreshWorkspace = function handleRefreshWorkspace() {
|
|
1744
|
+
setLoading(function (prev) {
|
|
1745
|
+
return _extends({}, prev, { refreshWorkspace: true });
|
|
1746
|
+
});
|
|
1747
|
+
GitService.fetchStatus()["catch"](function () {});
|
|
1748
|
+
FileService.getTree().then(function (data) {
|
|
1749
|
+
var newData = data || [];
|
|
1750
|
+
setTreeData(function (prevData) {
|
|
1751
|
+
if (JSON.stringify(newData) === JSON.stringify(prevData)) return prevData;
|
|
1752
|
+
SearchService.buildIndex(newData);
|
|
1753
|
+
return newData;
|
|
1754
|
+
});
|
|
1755
|
+
checkOpenTabsForExternalChanges();
|
|
1756
|
+
EditorStore.setStatus("Workspace refreshed", "success");
|
|
1757
|
+
})["catch"](function (err) {
|
|
1758
|
+
EditorStore.setStatus("Failed to refresh workspace", "error");
|
|
1759
|
+
})["finally"](function () {
|
|
1760
|
+
setLoading(function (prev) {
|
|
1761
|
+
return _extends({}, prev, { refreshWorkspace: false });
|
|
1762
|
+
});
|
|
1763
|
+
});
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1743
1766
|
var handleFormat = function handleFormat() {
|
|
1744
1767
|
if (!activeTab) return;
|
|
1745
1768
|
|
|
@@ -2971,6 +2994,13 @@ var MbeditorApp = function MbeditorApp() {
|
|
|
2971
2994
|
actions: React.createElement(
|
|
2972
2995
|
SectionActionGroup,
|
|
2973
2996
|
{ ariaLabel: "Project actions" },
|
|
2997
|
+
React.createElement(SidebarActionButton, {
|
|
2998
|
+
title: "Refresh workspace",
|
|
2999
|
+
iconClass: "fas fa-sync-alt",
|
|
3000
|
+
ariaBusy: !!loading.refreshWorkspace,
|
|
3001
|
+
onClick: handleRefreshWorkspace,
|
|
3002
|
+
disabled: !!loading.refreshWorkspace
|
|
3003
|
+
}),
|
|
2974
3004
|
React.createElement(SidebarActionButton, {
|
|
2975
3005
|
title: "Collapse all folders",
|
|
2976
3006
|
iconClass: "fas fa-compress-alt",
|
|
@@ -61,6 +61,7 @@ var SearchService = (function () {
|
|
|
61
61
|
|
|
62
62
|
function traverse(nodes) {
|
|
63
63
|
nodes.forEach(function(n) {
|
|
64
|
+
if (n.excluded) return; // skip excluded paths and their descendants
|
|
64
65
|
if (n.type === 'file') {
|
|
65
66
|
docs.push({ id: idCounter++, path: n.path, name: n.name, type: 'file' });
|
|
66
67
|
} else if (n.type === 'folder') {
|
|
@@ -702,7 +702,8 @@ module Mbeditor
|
|
|
702
702
|
|
|
703
703
|
# GET /mbeditor/manifest.webmanifest — PWA manifest
|
|
704
704
|
def pwa_manifest
|
|
705
|
-
|
|
705
|
+
_mount = request.script_name.to_s.gsub(%r{(^/+|/+$)}, "")
|
|
706
|
+
base = _mount.empty? ? "" : "/#{_mount}"
|
|
706
707
|
manifest = {
|
|
707
708
|
name: "Mbeditor — #{Rails.root.basename}",
|
|
708
709
|
short_name: "Mbeditor",
|
|
@@ -1070,10 +1071,14 @@ module Mbeditor
|
|
|
1070
1071
|
rel = relative_path(full)
|
|
1071
1072
|
|
|
1072
1073
|
if File.directory?(full)
|
|
1073
|
-
{ name: name, type: "folder", path: rel, children: build_tree(full, depth: depth + 1) }
|
|
1074
|
+
node = { name: name, type: "folder", path: rel, children: build_tree(full, depth: depth + 1) }
|
|
1075
|
+
node[:excluded] = true if excluded_path?(rel, name)
|
|
1076
|
+
node
|
|
1074
1077
|
else
|
|
1075
1078
|
size = File.size(full) rescue nil
|
|
1076
|
-
{ name: name, type: "file", path: rel, size: size }
|
|
1079
|
+
node = { name: name, type: "file", path: rel, size: size }
|
|
1080
|
+
node[:excluded] = true if excluded_path?(rel, name)
|
|
1081
|
+
node
|
|
1077
1082
|
end
|
|
1078
1083
|
end
|
|
1079
1084
|
rescue Errno::EACCES
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="theme-color" content="#1e1e2e" />
|
|
8
8
|
<meta name="mobile-web-app-capable" content="yes" />
|
|
9
9
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
10
|
-
<%
|
|
10
|
+
<% _mount = request.script_name.to_s.gsub(%r{(^/+|/+$)}, ''); pwa_base = _mount.empty? ? '' : "/#{_mount}" %>
|
|
11
11
|
<link rel="manifest" href="<%= "#{pwa_base}/manifest.webmanifest" %>" />
|
|
12
12
|
<script>
|
|
13
13
|
if ('serviceWorker' in navigator) {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<script defer src="<%= asset_path('minisearch.min.js') %>"></script>
|
|
33
33
|
<script defer src="<%= asset_path('marked.min.js') %>"></script>
|
|
34
34
|
<!-- ── Monaco loader (sync — inline body script calls require()) ── -->
|
|
35
|
-
<% base_path =
|
|
35
|
+
<% base_path = pwa_base %>
|
|
36
36
|
<script>var require = { paths: { vs: '<%= json_escape("#{base_path}/monaco-editor/vs") %>', 'monaco-editor/esm/vs': '<%= json_escape("#{base_path}/monaco-editor/vs") %>', 'monaco-vim': '<%= json_escape(asset_path("monaco-vim.js").sub(/\.js$/, "")) %>' } };</script>
|
|
37
37
|
<script src="<%= "#{base_path}/monaco-editor/vs/loader.js" %>"></script>
|
|
38
38
|
<!-- ── Emmet + Extra themes (non-AMD, deferred — used inside Monaco callback) ── -->
|
data/lib/mbeditor/version.rb
CHANGED