mbeditor 0.14.2 → 0.14.3
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/CHANGELOG.md +43 -0
- data/app/assets/javascripts/mbeditor/application.js +5 -1
- data/app/assets/javascripts/mbeditor/collaboration_identity.js +4 -2
- data/app/assets/javascripts/mbeditor/collaboration_service.js +74 -2
- data/app/assets/javascripts/mbeditor/components/AiRoundTripModal.js +452 -0
- data/app/assets/javascripts/mbeditor/components/ChangelogView.js +1 -1
- data/app/assets/javascripts/mbeditor/components/CombinedFileView.js +3 -2
- data/app/assets/javascripts/mbeditor/components/EditorPanel.js +28 -27
- data/app/assets/javascripts/mbeditor/components/FileHistoryPanel.js +2 -7
- data/app/assets/javascripts/mbeditor/components/FileTree.js +144 -4
- data/app/assets/javascripts/mbeditor/components/GitPanel.js +1 -1
- data/app/assets/javascripts/mbeditor/components/ImportConflictModal.js +7 -68
- data/app/assets/javascripts/mbeditor/components/ImportDialog.js +2 -16
- data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +340 -472
- data/app/assets/javascripts/mbeditor/components/ModalDialog.js +203 -0
- data/app/assets/javascripts/mbeditor/components/PastePlaceModal.js +1 -9
- data/app/assets/javascripts/mbeditor/components/Popover.js +88 -0
- data/app/assets/javascripts/mbeditor/components/PopupMenu.js +166 -0
- data/app/assets/javascripts/mbeditor/components/ProblemsPanel.js +8 -4
- data/app/assets/javascripts/mbeditor/components/QuickOpenDialog.js +5 -7
- data/app/assets/javascripts/mbeditor/components/SettingsModal.js +3 -14
- data/app/assets/javascripts/mbeditor/components/ShortcutHelp.js +4 -25
- data/app/assets/javascripts/mbeditor/components/TabBar.js +15 -32
- data/app/assets/javascripts/mbeditor/components/TestResultsPanel.js +2 -7
- data/app/assets/javascripts/mbeditor/editor_plugins.js +3 -23
- data/app/assets/javascripts/mbeditor/file_service.js +1 -1
- data/app/assets/javascripts/mbeditor/git_service.js +0 -7
- data/app/assets/javascripts/mbeditor/patch_select.js +156 -0
- data/app/assets/javascripts/mbeditor/tab_manager.js +19 -0
- data/app/assets/stylesheets/mbeditor/application.css +7 -110
- data/app/assets/stylesheets/mbeditor/editor.css +195 -192
- data/app/assets/stylesheets/mbeditor/glass.css +1 -1
- data/app/channels/mbeditor/collaboration_channel.rb +24 -5
- data/app/controllers/mbeditor/editors_controller.rb +75 -38
- data/app/controllers/mbeditor/git_controller.rb +1 -12
- data/app/services/mbeditor/ai_bundle_service.rb +181 -0
- data/app/services/mbeditor/archive_service.rb +43 -6
- data/app/services/mbeditor/availability_probe.rb +2 -2
- data/app/services/mbeditor/code_search_service.rb +1 -3
- data/app/services/mbeditor/collaboration_doc_store.rb +37 -1
- data/app/services/mbeditor/exclusion_matcher.rb +0 -4
- data/app/services/mbeditor/file_import_service.rb +4 -1
- data/app/services/mbeditor/file_operation_service.rb +3 -3
- data/app/services/mbeditor/git_service.rb +11 -45
- data/app/services/mbeditor/js_definition_service.rb +1 -0
- data/app/services/mbeditor/model_graph_service.rb +1 -0
- data/app/services/mbeditor/patch_apply_service.rb +185 -0
- data/app/services/mbeditor/rails_related_files_service.rb +1 -1
- data/app/services/mbeditor/redmine_config_error.rb +6 -0
- data/app/services/mbeditor/redmine_disabled_error.rb +10 -0
- data/app/services/mbeditor/redmine_service.rb +0 -8
- data/app/services/mbeditor/ruby_definition_service.rb +1 -0
- data/app/services/mbeditor/schema_service.rb +1 -0
- data/app/services/mbeditor/test_runner_service.rb +1 -1
- data/lib/mbeditor/rack/silence_ping_request.rb +14 -14
- data/lib/mbeditor/route_map.rb +5 -2
- data/lib/mbeditor/ruby_lsp_client.rb +7 -26
- data/lib/mbeditor/version.rb +1 -1
- data/public/monaco-editor/VERSIONS +2 -1
- data/public/monaco-editor/monaco.js +226 -226
- metadata +11 -4
- data/app/assets/javascripts/mbeditor/components/CommitGraph.js +0 -65
- data/app/services/mbeditor/git_commit_graph_service.rb +0 -62
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fc498e721a6a3b9cb8aa187521e9e364a3a7362805b9f4a6e6607160ee4d959
|
|
4
|
+
data.tar.gz: ac57067a597ef2d067bc230f67b63b15c3b0117798c6a19611eae14fae7f9a0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5562930f430efcc27e92c39a7b6a35c91fc3727f42bca96fb3f49b2df4494ab6cc1a72b72fe9600e810b330b4f1dba1cc46868c35078cb0ff981f2fb1f7d2a80
|
|
7
|
+
data.tar.gz: fb7cbc0cdbcfd74a690efb84fc8a7df18aa5b252c64c4b48e1535c22671077cc928ae3fb22f8b812afaf219d8b8d57c74e63e6af71d7c415436144f3c719c55d
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,49 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.14.3] - 2026-11-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **AI round trip** (robot button, top right). Export the project, with a
|
|
12
|
+
choice of folders, as one Markdown bundle for a web chat assistant. A
|
|
13
|
+
separate short prompt tells the agent to unpack it and grep it instead of
|
|
14
|
+
reading it whole. Paste or upload the unified diff it returns to see one
|
|
15
|
+
scrollable, syntax-highlighted red/green view. Choose which hunks to keep,
|
|
16
|
+
then apply them with `git apply`. Files can be created, deleted and
|
|
17
|
+
renamed.
|
|
18
|
+
- **Rails panel**: open files are outlined, and an "Open all" button opens
|
|
19
|
+
every file of a resource (e.g. all User files).
|
|
20
|
+
- **Keyboard-operable file tree** following the WAI-ARIA tree pattern
|
|
21
|
+
(arrows, Home/End, Enter, Space, type-to-find).
|
|
22
|
+
- **Keyboard-operable context menus** in the explorer and tabs (arrows,
|
|
23
|
+
Enter/Space, Esc, Shift+F10).
|
|
24
|
+
- Correctness lint for Ruby (`bundle exec rubocop`, Lint department only)
|
|
25
|
+
and JS (`npm run lint:js`), run in CI.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- Every modal is a native `<dialog>`, and menus and hovercards are popovers.
|
|
29
|
+
They now get the browser's focus containment, Esc handling and top layer,
|
|
30
|
+
and follow the light theme. `window.confirm` and `window.prompt` are
|
|
31
|
+
replaced by in-app dialogs, so they no longer block the page.
|
|
32
|
+
- Themed scrollbars in Firefox (`scrollbar-color` / `scrollbar-width`).
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- **Import and export hardening** after an audit:
|
|
36
|
+
- The AI bundle skips secrets (`.env*`, keys, credentials).
|
|
37
|
+
- Unpacking survives a file that contains its own end marker.
|
|
38
|
+
- Non-ASCII names no longer crash, and errors never show host paths.
|
|
39
|
+
- Patches cannot write excluded paths or create symlinks.
|
|
40
|
+
- Imports overwrite files atomically.
|
|
41
|
+
- `/raw` serves markup sandboxed as plain text.
|
|
42
|
+
- **A shared (collaborative) tab no longer reverts an applied patch or an
|
|
43
|
+
external edit.** It takes the new disk content once, without duplicating
|
|
44
|
+
it. Unsaved shared edits are kept, and the reload banner shows instead.
|
|
45
|
+
- A file opened from Quick Open now gets editor focus.
|
|
46
|
+
- Esc no longer threw a ReferenceError.
|
|
47
|
+
- ruby-lsp now restarts once its crash window has passed. Before, it stayed
|
|
48
|
+
failed until Rails restarted.
|
|
49
|
+
- Monaco ships a patched DOMPurify.
|
|
50
|
+
|
|
8
51
|
## [0.14.2] - 2026-10-20
|
|
9
52
|
|
|
10
53
|
### Added
|
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
//= require mbeditor/ruby_outline
|
|
19
19
|
//= require mbeditor/js_outline
|
|
20
20
|
//= require mbeditor/components/CollapsibleSection
|
|
21
|
+
//= require mbeditor/components/ModalDialog
|
|
22
|
+
//= require mbeditor/components/Popover
|
|
23
|
+
//= require mbeditor/components/PopupMenu
|
|
21
24
|
//= require mbeditor/components/SettingsModal
|
|
22
25
|
//= require mbeditor/components/Gutter
|
|
23
26
|
//= require mbeditor/components/ShortcutHelp
|
|
24
27
|
//= require mbeditor/components/DiffViewer
|
|
25
28
|
//= require mbeditor/components/CombinedDiffViewer
|
|
26
|
-
//= require mbeditor/components/CommitGraph
|
|
27
29
|
//= require mbeditor/components/ModelGraph
|
|
28
30
|
//= require mbeditor/components/ChangelogView
|
|
29
31
|
//= require mbeditor/components/CombinedFileView
|
|
@@ -43,6 +45,8 @@
|
|
|
43
45
|
// whole app down the first time it renders.
|
|
44
46
|
//= require mbeditor/components/ImportConflictModal
|
|
45
47
|
//= require mbeditor/components/ImportDialog
|
|
48
|
+
//= require mbeditor/patch_select
|
|
49
|
+
//= require mbeditor/components/AiRoundTripModal
|
|
46
50
|
//= require mbeditor/components/PastePlaceModal
|
|
47
51
|
//= require mbeditor/components/MbeditorApp
|
|
48
52
|
//= require mbeditor/application_iife_tail
|
|
@@ -206,10 +206,12 @@ var CollaborationIdentity = (function () {
|
|
|
206
206
|
|
|
207
207
|
// Prompt-based editor wired to the status-bar presence chip. Returns nothing;
|
|
208
208
|
// listeners pick up the change and push it onto live awareness.
|
|
209
|
+
// MbeditorDialogs is defined later in the bundle (ModalDialog.js) but is
|
|
210
|
+
// only read at call time, by which point the whole bundle has run.
|
|
209
211
|
function editName() {
|
|
210
212
|
var current = get().name;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
window.MbeditorDialogs.prompt({ title: 'Collaboration name', message: 'Shown to people editing with you.', value: current, confirmLabel: 'Save' })
|
|
214
|
+
.then(function (next) { if (next != null) setName(next); });
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
// Subscribe to identity changes (name or colour). Returns an unsubscribe fn.
|
|
@@ -407,6 +407,9 @@ var CollaborationService = (function () {
|
|
|
407
407
|
// A peer's replay was incomplete. Answer with our full state if we hold
|
|
408
408
|
// one, so it can attach instead of diverging on stale text.
|
|
409
409
|
if (room.binding && room.text.length > 0) pushSnapshot(room.path);
|
|
410
|
+
} else if (data.type === 'disk_claim') {
|
|
411
|
+
var onClaim = room.diskClaims && room.diskClaims[data.key];
|
|
412
|
+
if (onClaim) { delete room.diskClaims[data.key]; onClaim(!!data.granted); }
|
|
410
413
|
} else if (data.type === 'awareness') {
|
|
411
414
|
if (data.awareness && room.awareness && window.awarenessProtocol) {
|
|
412
415
|
// REMOTE origin keeps the outbound handler from echoing peer state back.
|
|
@@ -895,8 +898,7 @@ var CollaborationService = (function () {
|
|
|
895
898
|
|
|
896
899
|
// True when the room owns the file's content (a late-join applied shared state):
|
|
897
900
|
// EditorPanel must then NOT apply the disk content at open, which would clobber it.
|
|
898
|
-
// Later external on-disk edits
|
|
899
|
-
// (MbeditorApp.checkOpenTabsForExternalChanges), which skips any collab-bound file.
|
|
901
|
+
// Later external on-disk edits reach an attached room through applyDiskContent.
|
|
900
902
|
function consumesDiskLoad(path) {
|
|
901
903
|
var room = _rooms[path];
|
|
902
904
|
return !!(room && room.binding && room.lateJoin);
|
|
@@ -984,6 +986,74 @@ var CollaborationService = (function () {
|
|
|
984
986
|
return !!(room && room.binding);
|
|
985
987
|
}
|
|
986
988
|
|
|
989
|
+
function _normEol(s) { return String(s).replace(/\r\n/g, '\n'); }
|
|
990
|
+
|
|
991
|
+
// FNV-1a: an opaque key the server compares for equality, nothing more.
|
|
992
|
+
function _contentKey(s) {
|
|
993
|
+
var h = 0x811c9dc5;
|
|
994
|
+
for (var i = 0; i < s.length; i++) {
|
|
995
|
+
h ^= s.charCodeAt(i);
|
|
996
|
+
h = Math.imul(h, 0x01000193);
|
|
997
|
+
}
|
|
998
|
+
return s.length + ':' + (h >>> 0).toString(16);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// The file was rewritten on disk (apply patch, import) while this room's
|
|
1002
|
+
// shared text still holds the old version. Every attached client calls this,
|
|
1003
|
+
// but only the one the server grants (claim_disk_write) replaces the text;
|
|
1004
|
+
// two replacements would insert two copies. The rest receive it as a
|
|
1005
|
+
// doc_update. onConverged fires on each client once its text matches disk,
|
|
1006
|
+
// so it can rebaseline the tab as clean. Returns false when not attached.
|
|
1007
|
+
function applyDiskContent(path, content, onConverged) {
|
|
1008
|
+
var room = _rooms[path];
|
|
1009
|
+
if (!room || !room.binding || !room.subscription) return false;
|
|
1010
|
+
// Stop listening if the granted peer's update never arrives; the next
|
|
1011
|
+
// external-change check finds the tab still behind and asks again.
|
|
1012
|
+
var watch = _watchText(room, content, onConverged, 15000);
|
|
1013
|
+
if (watch.done()) return true;
|
|
1014
|
+
var key = _contentKey(_normEol(content));
|
|
1015
|
+
room.diskClaims = room.diskClaims || {};
|
|
1016
|
+
room.diskClaims[key] = function (granted) {
|
|
1017
|
+
if (!granted || watch.done() || !room.binding) return;
|
|
1018
|
+
room.doc.transact(function () {
|
|
1019
|
+
room.text.delete(0, room.text.length);
|
|
1020
|
+
room.text.insert(0, content);
|
|
1021
|
+
});
|
|
1022
|
+
};
|
|
1023
|
+
try { room.subscription.perform('claim_disk_write', { key: key }); } catch (e) { /* cable down */ }
|
|
1024
|
+
return true;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// A tab waiting on a reload banner: a peer may resolve it (Discard & Reload)
|
|
1028
|
+
// without any disk write, so no files_changed ever reaches this client. Fire
|
|
1029
|
+
// cb once the shared text equals content. No timeout; leaveRoom destroys the
|
|
1030
|
+
// doc and its observers with it.
|
|
1031
|
+
function whenContentMatches(path, content, cb) {
|
|
1032
|
+
var room = _rooms[path];
|
|
1033
|
+
if (!room || !room.binding) return false;
|
|
1034
|
+
_watchText(room, content, cb, 0);
|
|
1035
|
+
return true;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
function _watchText(room, content, cb, timeoutMs) {
|
|
1039
|
+
var target = _normEol(content);
|
|
1040
|
+
var done = false;
|
|
1041
|
+
var timer = null;
|
|
1042
|
+
var settle = function () {
|
|
1043
|
+
if (done || _normEol(room.text.toString()) !== target) return;
|
|
1044
|
+
done = true;
|
|
1045
|
+
room.text.unobserve(settle);
|
|
1046
|
+
if (timer) clearTimeout(timer);
|
|
1047
|
+
cb();
|
|
1048
|
+
};
|
|
1049
|
+
settle();
|
|
1050
|
+
if (!done) {
|
|
1051
|
+
room.text.observe(settle);
|
|
1052
|
+
if (timeoutMs) timer = setTimeout(function () { done = true; room.text.unobserve(settle); }, timeoutMs);
|
|
1053
|
+
}
|
|
1054
|
+
return { done: function () { return done; } };
|
|
1055
|
+
}
|
|
1056
|
+
|
|
987
1057
|
// Push a fresh full snapshot to the server so it can compact the doc store:
|
|
988
1058
|
// CollaborationDocStore.replace_snapshot swaps the cached snapshot and keeps
|
|
989
1059
|
// only the deltas recorded after `applied_seq` (the newest sequence this client
|
|
@@ -1019,6 +1089,8 @@ var CollaborationService = (function () {
|
|
|
1019
1089
|
isBound: isBound,
|
|
1020
1090
|
isAttached: isAttached,
|
|
1021
1091
|
pushSnapshot: pushSnapshot,
|
|
1092
|
+
applyDiskContent: applyDiskContent,
|
|
1093
|
+
whenContentMatches: whenContentMatches,
|
|
1022
1094
|
setFollow: setFollow,
|
|
1023
1095
|
clearFollow: clearFollow
|
|
1024
1096
|
};
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Round trip with a web chat: "Export" downloads the chosen directories as one
|
|
4
|
+
// markdown bundle to upload; "Apply diff" checks and applies the unified diff
|
|
5
|
+
// the chat replies with. Reuses the schema-modal shell and the import-conflict
|
|
6
|
+
// buttons; refreshing open tabs after an apply is left to the files_changed
|
|
7
|
+
// broadcast the server sends for the write.
|
|
8
|
+
var AI_SELECTION_KEY = 'mbeditor.aiBundle.selection';
|
|
9
|
+
|
|
10
|
+
function aiFolderPaths(nodes, into) {
|
|
11
|
+
nodes.forEach(function (n) {
|
|
12
|
+
if (n.type !== 'folder') return;
|
|
13
|
+
into[n.path] = true;
|
|
14
|
+
aiFolderPaths(n.children || [], into);
|
|
15
|
+
});
|
|
16
|
+
return into;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// A saved directory that has since been deleted would 404 the whole export, so
|
|
20
|
+
// saved dirs are checked against the tree (when it has loaded).
|
|
21
|
+
function aiLoadSelection(treeData) {
|
|
22
|
+
try {
|
|
23
|
+
var saved = JSON.parse(localStorage.getItem(AI_SELECTION_KEY) || '{}');
|
|
24
|
+
var dirs = Array.isArray(saved.dirs) ? saved.dirs : [];
|
|
25
|
+
if (treeData.length) {
|
|
26
|
+
var known = aiFolderPaths(treeData, {});
|
|
27
|
+
dirs = dirs.filter(function (d) { return known[d]; });
|
|
28
|
+
}
|
|
29
|
+
return { dirs: dirs, topFiles: saved.topFiles === true };
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return { dirs: [], topFiles: false };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function aiHumanSize(bytes) {
|
|
36
|
+
return bytes >= 1048576 ? (bytes / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(bytes / 1024)) + ' KB';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// A pasted bundle lands entirely in the chat's context; no sandbox sees it.
|
|
40
|
+
var AI_PASTE_TOKEN_WARN = 100000;
|
|
41
|
+
|
|
42
|
+
var AI_COLORIZE_MAX_LINES = 2000;
|
|
43
|
+
|
|
44
|
+
function aiHeaderClass(text) {
|
|
45
|
+
return /^(---|\+\+\+) /.test(text) ? 'file' : 'meta';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function aiBodyClass(c) {
|
|
49
|
+
return c === '+' ? 'add' : c === '-' ? 'del' : c === '\\' ? 'meta' : 'ctx';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// One hunk. Plain text nodes first; when Monaco can tokenise the file's
|
|
53
|
+
// language the code is swapped for its markup, keeping the +/- line colours.
|
|
54
|
+
var AiDiffHunk = function AiDiffHunk(_ref) {
|
|
55
|
+
var h = React.createElement;
|
|
56
|
+
var lines = _ref.text.replace(/\n$/, '').split('\n');
|
|
57
|
+
var body = lines.slice(1);
|
|
58
|
+
var _html = React.useState(null);
|
|
59
|
+
var html = _html[0];
|
|
60
|
+
var setHtml = _html[1];
|
|
61
|
+
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
setHtml(null);
|
|
64
|
+
var lang = window.MbeditorLanguageForPath && window.MbeditorLanguageForPath(_ref.path);
|
|
65
|
+
if (!lang || body.length > AI_COLORIZE_MAX_LINES) return undefined;
|
|
66
|
+
var cancelled = false;
|
|
67
|
+
var code = body.filter(function (l) { return l[0] !== '\\'; }).map(function (l) { return l.slice(1); });
|
|
68
|
+
try {
|
|
69
|
+
window.monaco.editor.colorize(code.join('\n'), lang, {}).then(function (out) {
|
|
70
|
+
var parts = out.split('<br/>');
|
|
71
|
+
if (parts.length === code.length + 1 && parts[parts.length - 1] === '') parts.pop();
|
|
72
|
+
if (!cancelled && parts.length === code.length) setHtml(parts);
|
|
73
|
+
}, function () { /* plain text stays */ });
|
|
74
|
+
} catch (e) { /* plain text stays */ }
|
|
75
|
+
return function () { cancelled = true; };
|
|
76
|
+
}, [_ref.text, _ref.path]);
|
|
77
|
+
|
|
78
|
+
var n = 0;
|
|
79
|
+
return h('div', { className: _ref.on ? '' : 'ai-diff-off' },
|
|
80
|
+
h('div', { className: 'ai-diff-line ai-diff-hunk ai-hunk-row' }, _ref.checkbox, lines[0]),
|
|
81
|
+
body.map(function (l, i) {
|
|
82
|
+
var colored = html && l[0] !== '\\' ? html[n++] : null;
|
|
83
|
+
return h('div', { key: i, className: 'ai-diff-line ai-diff-' + aiBodyClass(l[0]) },
|
|
84
|
+
h('span', { className: 'ai-diff-prefix' }, l[0] || ' '),
|
|
85
|
+
// colorize returns Monaco's own escaped token markup, built from the
|
|
86
|
+
// diff text but never containing it raw; this is the one place HTML
|
|
87
|
+
// is injected, and nothing else from the patch goes through it.
|
|
88
|
+
colored !== null
|
|
89
|
+
? h('span', { dangerouslySetInnerHTML: { __html: colored } })
|
|
90
|
+
: l.slice(1));
|
|
91
|
+
}));
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var AiRoundTripModal = function AiRoundTripModal(_ref) {
|
|
95
|
+
var h = React.createElement;
|
|
96
|
+
var treeData = _ref.treeData || [];
|
|
97
|
+
var onClose = _ref.onClose;
|
|
98
|
+
|
|
99
|
+
var _tab = React.useState('export');
|
|
100
|
+
var tab = _tab[0];
|
|
101
|
+
var setTab = _tab[1];
|
|
102
|
+
|
|
103
|
+
var initial = React.useMemo(function () { return aiLoadSelection(treeData); }, []);
|
|
104
|
+
var _dirs = React.useState(initial.dirs);
|
|
105
|
+
var dirs = _dirs[0];
|
|
106
|
+
var setDirs = _dirs[1];
|
|
107
|
+
var _top = React.useState(initial.topFiles);
|
|
108
|
+
var topFiles = _top[0];
|
|
109
|
+
var setTopFiles = _top[1];
|
|
110
|
+
var _open = React.useState({});
|
|
111
|
+
var open = _open[0];
|
|
112
|
+
var setOpen = _open[1];
|
|
113
|
+
var _exp = React.useState({ busy: false, error: null, stats: null, pendingCopy: null, notice: null });
|
|
114
|
+
var exp = _exp[0];
|
|
115
|
+
var setExp = _exp[1];
|
|
116
|
+
|
|
117
|
+
// Fetched on open so the click can call writeText synchronously and keep the
|
|
118
|
+
// user gesture in Safari.
|
|
119
|
+
var _prompt = React.useState(null);
|
|
120
|
+
var promptText = _prompt[0];
|
|
121
|
+
var setPromptText = _prompt[1];
|
|
122
|
+
React.useEffect(function () {
|
|
123
|
+
fetch(window.mbeditorBasePath() + '/ai_bundle?prompt=1').then(function (r) {
|
|
124
|
+
return r.ok ? r.text() : null;
|
|
125
|
+
}).then(setPromptText, function () { setPromptText(null); });
|
|
126
|
+
}, []);
|
|
127
|
+
|
|
128
|
+
var _patch = React.useState('');
|
|
129
|
+
var patch = _patch[0];
|
|
130
|
+
var setPatch = _patch[1];
|
|
131
|
+
var _apply = React.useState({ busy: false, error: null, files: null, checkedPatch: null, applied: false });
|
|
132
|
+
var apply = _apply[0];
|
|
133
|
+
var setApply = _apply[1];
|
|
134
|
+
|
|
135
|
+
var rootFiles = treeData.filter(function (n) { return n.type === 'file'; });
|
|
136
|
+
|
|
137
|
+
var persist = function (nextDirs, nextTop) {
|
|
138
|
+
try { localStorage.setItem(AI_SELECTION_KEY, JSON.stringify({ dirs: nextDirs, topFiles: nextTop })); } catch (e) { /* storage unavailable */ }
|
|
139
|
+
};
|
|
140
|
+
var toggleDir = function (path) {
|
|
141
|
+
var next = dirs.indexOf(path) === -1 ? dirs.concat(path) : dirs.filter(function (p) { return p !== path; });
|
|
142
|
+
setDirs(next);
|
|
143
|
+
persist(next, topFiles);
|
|
144
|
+
};
|
|
145
|
+
var toggleTop = function () {
|
|
146
|
+
setTopFiles(!topFiles);
|
|
147
|
+
persist(dirs, !topFiles);
|
|
148
|
+
};
|
|
149
|
+
var coveredBy = function (path) {
|
|
150
|
+
return dirs.some(function (d) { return path.indexOf(d + '/') === 0; });
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
var selectedPaths = dirs.filter(function (d) { return !coveredBy(d); })
|
|
154
|
+
.concat(topFiles ? rootFiles.map(function (f) { return f.path; }) : []);
|
|
155
|
+
|
|
156
|
+
var errorMessage = function (err) {
|
|
157
|
+
return (err && err.response && err.response.data && err.response.data.error) || (err && err.message) || 'Request failed';
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
var fetchBundle = function () {
|
|
161
|
+
var url = window.mbeditorBasePath() + '/ai_bundle?' + selectedPaths.map(function (p) {
|
|
162
|
+
return 'paths[]=' + encodeURIComponent(p);
|
|
163
|
+
}).join('&');
|
|
164
|
+
return fetch(url).then(function (resp) {
|
|
165
|
+
if (!resp.ok) {
|
|
166
|
+
return resp.json().catch(function () { return {}; }).then(function (body) {
|
|
167
|
+
throw new Error((body && body.error) || ('HTTP ' + resp.status));
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
var disposition = resp.headers.get('Content-Disposition');
|
|
171
|
+
var match = disposition && disposition.match(/filename="([^"]+)"/);
|
|
172
|
+
var num = function (name) { return parseInt(resp.headers.get(name), 10) || 0; };
|
|
173
|
+
return resp.blob().then(function (blob) {
|
|
174
|
+
return {
|
|
175
|
+
blob: blob, filename: (match && match[1]) || 'bundle.md',
|
|
176
|
+
stats: {
|
|
177
|
+
files: num('X-Mbeditor-Bundle-Files'), bytes: num('X-Mbeditor-Bundle-Bytes')
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
var idle = { busy: false, error: null, stats: null, pendingCopy: null, notice: null };
|
|
185
|
+
|
|
186
|
+
var download = function () {
|
|
187
|
+
setExp(Object.assign({}, idle, { busy: true }));
|
|
188
|
+
fetchBundle().then(function (r) {
|
|
189
|
+
var objectUrl = URL.createObjectURL(r.blob);
|
|
190
|
+
var link = document.createElement('a');
|
|
191
|
+
link.href = objectUrl;
|
|
192
|
+
link.download = r.filename;
|
|
193
|
+
link.rel = 'noopener';
|
|
194
|
+
document.body.appendChild(link);
|
|
195
|
+
link.click();
|
|
196
|
+
document.body.removeChild(link);
|
|
197
|
+
setTimeout(function () { URL.revokeObjectURL(objectUrl); }, 60000);
|
|
198
|
+
setExp(Object.assign({}, idle, { stats: Object.assign({ filename: r.filename }, r.stats) }));
|
|
199
|
+
}).catch(function (err) {
|
|
200
|
+
setExp(Object.assign({}, idle, { error: err.message || 'network error' }));
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
var copied = function (stats) {
|
|
205
|
+
setExp(Object.assign({}, idle, { stats: Object.assign({ filename: 'Copied' }, stats), notice: 'Copied to clipboard.' }));
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
var copyFailed = function (err) {
|
|
209
|
+
setExp(Object.assign({}, idle, { error: 'Could not copy: ' + (err && err.message || 'clipboard unavailable') }));
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
var writeClipboard = function (text, stats) {
|
|
213
|
+
return navigator.clipboard.writeText(text).then(function () { copied(stats); }, copyFailed);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// Safari drops the user gesture across an async fetch, so where ClipboardItem
|
|
217
|
+
// exists the write starts synchronously inside the click and is handed a
|
|
218
|
+
// promise for the text. An oversized bundle rejects that promise, so nothing
|
|
219
|
+
// is copied, and the text kept in `big` goes to "Copy anyway", which writes
|
|
220
|
+
// inside its own click.
|
|
221
|
+
var copyBundle = function () {
|
|
222
|
+
setExp(Object.assign({}, idle, { busy: true }));
|
|
223
|
+
var big = null;
|
|
224
|
+
var stats = null;
|
|
225
|
+
var buildError = null;
|
|
226
|
+
var load = fetchBundle().then(function (r) {
|
|
227
|
+
stats = r.stats;
|
|
228
|
+
return r.blob.text().then(function (text) {
|
|
229
|
+
if (r.stats.bytes / 4 > AI_PASTE_TOKEN_WARN) {
|
|
230
|
+
big = text;
|
|
231
|
+
throw new Error('Over ' + AI_PASTE_TOKEN_WARN.toLocaleString() + ' tokens, not copied');
|
|
232
|
+
}
|
|
233
|
+
return text;
|
|
234
|
+
});
|
|
235
|
+
}, function (err) {
|
|
236
|
+
buildError = err;
|
|
237
|
+
throw err;
|
|
238
|
+
});
|
|
239
|
+
var fail = function (err) {
|
|
240
|
+
if (big !== null) setExp(Object.assign({}, idle, { pendingCopy: { text: big, stats: stats } }));
|
|
241
|
+
else if (buildError) setExp(Object.assign({}, idle, { error: 'Could not build bundle: ' + (buildError.message || 'request failed') }));
|
|
242
|
+
else copyFailed(err);
|
|
243
|
+
};
|
|
244
|
+
if (window.ClipboardItem && navigator.clipboard && navigator.clipboard.write) {
|
|
245
|
+
var item = new ClipboardItem({
|
|
246
|
+
'text/plain': load.then(function (text) { return new Blob([text], { type: 'text/plain' }); })
|
|
247
|
+
});
|
|
248
|
+
navigator.clipboard.write([item]).then(function () { copied(stats); }, fail);
|
|
249
|
+
} else {
|
|
250
|
+
load.then(function (text) { return writeClipboard(text, stats); }, fail);
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
var copyPrompt = function () {
|
|
255
|
+
navigator.clipboard.writeText(promptText).then(function () {
|
|
256
|
+
setExp(Object.assign({}, idle, { notice: 'Prompt copied. Fill in the TASK line after pasting.' }));
|
|
257
|
+
}, copyFailed);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
var loadPatchFile = function (e) {
|
|
261
|
+
var file = e.target.files && e.target.files[0];
|
|
262
|
+
e.target.value = '';
|
|
263
|
+
if (!file) return;
|
|
264
|
+
file.text().then(function (text) {
|
|
265
|
+
setPatch(text);
|
|
266
|
+
setApply({ busy: false, error: null, files: null, checkedPatch: null, applied: false });
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
var postPatch = function (text, check) {
|
|
271
|
+
return axios.post(window.mbeditorBasePath() + '/apply_patch', { patch: text, check: check });
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
var check = function () {
|
|
275
|
+
var text = patch;
|
|
276
|
+
setApply({ busy: true, error: null, files: null, checkedPatch: null, applied: false });
|
|
277
|
+
postPatch(text, true).then(function (resp) {
|
|
278
|
+
var parsed = window.MbeditorPatchSelect.parse(resp.data.patch);
|
|
279
|
+
setApply({
|
|
280
|
+
busy: false, error: null, files: resp.data.files, checkedPatch: text, applied: false,
|
|
281
|
+
diff: resp.data.patch, parsed: parsed, sel: window.MbeditorPatchSelect.defaultSelection(parsed)
|
|
282
|
+
});
|
|
283
|
+
}, function (err) {
|
|
284
|
+
setApply({ busy: false, error: errorMessage(err), files: null, checkedPatch: null, applied: false });
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
var dirtyTouched = function () {
|
|
289
|
+
var touched = {};
|
|
290
|
+
window.MbeditorPatchSelect.touchedPaths(apply.parsed, apply.sel, apply.files).forEach(function (p) { touched[p] = true; });
|
|
291
|
+
var names = [];
|
|
292
|
+
EditorStore.getState().panes.forEach(function (p) {
|
|
293
|
+
p.tabs.forEach(function (t) { if (t.dirty && touched[t.path]) names.push(t.path); });
|
|
294
|
+
});
|
|
295
|
+
return names;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
var applyPatch = function () {
|
|
299
|
+
var dirty = dirtyTouched();
|
|
300
|
+
if (dirty.length) {
|
|
301
|
+
setApply(Object.assign({}, apply, { error: 'Save or close these files first, they have unsaved changes: ' + dirty.join(', ') }));
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
setApply(Object.assign({}, apply, { busy: true, error: null }));
|
|
305
|
+
postPatch(window.MbeditorPatchSelect.build(apply.parsed, apply.sel), false).then(function (resp) {
|
|
306
|
+
setApply({ busy: false, error: null, files: resp.data.files, checkedPatch: null, applied: true });
|
|
307
|
+
}, function (err) {
|
|
308
|
+
setApply(Object.assign({}, apply, { busy: false, error: errorMessage(err) }));
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
var setSel = function (i, next) {
|
|
313
|
+
var sel = apply.sel.slice();
|
|
314
|
+
sel[i] = next;
|
|
315
|
+
setApply(Object.assign({}, apply, { sel: sel }));
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
var renderDir = function (node, covered) {
|
|
319
|
+
var folders = (node.children || []).filter(function (c) { return c.type === 'folder'; });
|
|
320
|
+
var isOpen = open[node.path];
|
|
321
|
+
return h('li', { key: node.path },
|
|
322
|
+
h('div', { className: 'ai-dir-row' },
|
|
323
|
+
h('button', {
|
|
324
|
+
type: 'button', className: 'ai-dir-toggle', disabled: folders.length === 0,
|
|
325
|
+
'aria-label': (isOpen ? 'Collapse ' : 'Expand ') + node.name,
|
|
326
|
+
onClick: function () { var o = Object.assign({}, open); o[node.path] = !isOpen; setOpen(o); }
|
|
327
|
+
}, h('i', { className: 'fas fa-chevron-' + (isOpen ? 'down' : 'right'), style: { opacity: folders.length ? 1 : 0 } })),
|
|
328
|
+
h('label', null,
|
|
329
|
+
h('input', {
|
|
330
|
+
type: 'checkbox', checked: covered || dirs.indexOf(node.path) !== -1, disabled: covered,
|
|
331
|
+
onChange: function () { toggleDir(node.path); }
|
|
332
|
+
}),
|
|
333
|
+
' ' + node.name)),
|
|
334
|
+
isOpen && folders.length > 0 && h('ul', { className: 'ai-dir-list' },
|
|
335
|
+
folders.map(function (c) { return renderDir(c, covered || dirs.indexOf(node.path) !== -1); })));
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
var exportPane = h('div', { className: 'ai-pane' },
|
|
339
|
+
h('p', { className: 'ai-hint' }, 'Pick what the assistant should see. Upload the .md to the chat, then paste the prompt with it.'),
|
|
340
|
+
h('ul', { className: 'ai-dir-list' },
|
|
341
|
+
treeData.filter(function (n) { return n.type === 'folder' && n.name !== '.git'; }).map(function (n) { return renderDir(n, false); }),
|
|
342
|
+
h('li', { key: '__top_files' },
|
|
343
|
+
h('div', { className: 'ai-dir-row' },
|
|
344
|
+
h('span', { className: 'ai-dir-toggle' }),
|
|
345
|
+
h('label', null,
|
|
346
|
+
h('input', { type: 'checkbox', checked: topFiles, onChange: toggleTop }),
|
|
347
|
+
' Top-level files (' + rootFiles.length + ')')))),
|
|
348
|
+
exp.error && h('div', { className: 'ai-error' }, exp.error),
|
|
349
|
+
exp.pendingCopy && h('div', { className: 'ai-error' },
|
|
350
|
+
'About ' + Math.round(exp.pendingCopy.stats.bytes / 4).toLocaleString() + ' tokens. Pasted text goes entirely into the chat context and no sandbox sees it. Prefer Download .md. ',
|
|
351
|
+
h('button', {
|
|
352
|
+
type: 'button', className: 'import-conflict-btn',
|
|
353
|
+
onClick: function () { writeClipboard(exp.pendingCopy.text, exp.pendingCopy.stats); }
|
|
354
|
+
}, 'Copy anyway')),
|
|
355
|
+
exp.stats && h('div', { className: 'ai-result' },
|
|
356
|
+
exp.stats.filename + ': ' + exp.stats.files + ' files, ' + aiHumanSize(exp.stats.bytes) +
|
|
357
|
+
', about ' + Math.round(exp.stats.bytes / 4).toLocaleString() + ' tokens'),
|
|
358
|
+
exp.notice && h('div', { className: 'ai-result' }, exp.notice)
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
var filesList = apply.files && h('ul', { className: 'import-conflict-list ai-files' },
|
|
362
|
+
apply.files.map(function (f) {
|
|
363
|
+
return h('li', { key: f.path, title: f.path },
|
|
364
|
+
h('span', { className: 'ai-status ai-status-' + f.status }, f.status),
|
|
365
|
+
' ' + (f.from ? f.from + ' -> ' : '') + f.path + ' +' + f.added + ' -' + f.removed);
|
|
366
|
+
}));
|
|
367
|
+
|
|
368
|
+
var previewing = !apply.applied && !!apply.diff && apply.checkedPatch === patch;
|
|
369
|
+
|
|
370
|
+
var applyPane = h('div', { className: 'ai-pane' },
|
|
371
|
+
!previewing && h('p', { className: 'ai-hint' }, 'Paste the assistant\'s reply. Surrounding text and the code fence are ignored.'),
|
|
372
|
+
!previewing && h('label', { className: 'ai-file' }, 'Load .patch file: ',
|
|
373
|
+
h('input', { type: 'file', accept: '.patch,.diff,.txt', onChange: loadPatchFile })),
|
|
374
|
+
!previewing && h('textarea', {
|
|
375
|
+
className: 'ai-patch', value: patch, spellCheck: false, placeholder: 'diff --git a/... b/...',
|
|
376
|
+
onChange: function (e) { setPatch(e.target.value); }
|
|
377
|
+
}),
|
|
378
|
+
apply.error && h('pre', { className: 'ai-error' }, apply.error),
|
|
379
|
+
apply.applied && h('div', { className: 'ai-result' }, 'Applied ' + apply.files.length + ' file' + (apply.files.length === 1 ? '' : 's') + '.'),
|
|
380
|
+
previewing && h('div', { className: 'ai-result' }, 'Check passed. Will change:',
|
|
381
|
+
h('button', { type: 'button', className: 'ai-edit-diff', onClick: function () {
|
|
382
|
+
setApply({ busy: false, error: null, files: null, checkedPatch: null, applied: false });
|
|
383
|
+
} }, 'Edit diff')),
|
|
384
|
+
apply.applied && filesList,
|
|
385
|
+
previewing && h('div', { className: 'ai-diff', tabIndex: 0, 'aria-label': 'Diff preview' },
|
|
386
|
+
apply.parsed.map(function (f, i) {
|
|
387
|
+
var s = apply.sel[i];
|
|
388
|
+
var all = s.every(Boolean);
|
|
389
|
+
var some = s.some(Boolean);
|
|
390
|
+
return h('div', { key: i },
|
|
391
|
+
h('label', { className: 'ai-file-row' },
|
|
392
|
+
h('input', {
|
|
393
|
+
type: 'checkbox', checked: all,
|
|
394
|
+
ref: function (el) { if (el) el.indeterminate = some && !all; },
|
|
395
|
+
onChange: function () { setSel(i, s.map(function () { return !all; })); }
|
|
396
|
+
}),
|
|
397
|
+
h('span', { className: 'ai-status ai-status-' + f.status }, f.status),
|
|
398
|
+
(f.from ? f.from + ' -> ' : '') + f.path),
|
|
399
|
+
h('div', { className: some ? '' : 'ai-diff-off' },
|
|
400
|
+
f.header.replace(/\n$/, '').split('\n').map(function (l, k) {
|
|
401
|
+
return h('div', { key: k, className: 'ai-diff-line ai-diff-' + aiHeaderClass(l) }, l);
|
|
402
|
+
})),
|
|
403
|
+
f.hunks.map(function (text, j) {
|
|
404
|
+
return h(AiDiffHunk, {
|
|
405
|
+
key: j, text: text, path: f.path, on: f.atomic ? s[0] : s[j],
|
|
406
|
+
checkbox: f.atomic ? null : h('input', {
|
|
407
|
+
type: 'checkbox', checked: !!s[j], 'aria-label': 'Include hunk',
|
|
408
|
+
onChange: function () { var next = s.slice(); next[j] = !s[j]; setSel(i, next); }
|
|
409
|
+
})
|
|
410
|
+
});
|
|
411
|
+
}));
|
|
412
|
+
}))
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
var counts = previewing ? window.MbeditorPatchSelect.count(apply.parsed, apply.sel) : null;
|
|
416
|
+
var canApply = previewing && counts.selected > 0 && !apply.busy;
|
|
417
|
+
var exportDisabled = exp.busy || selectedPaths.length === 0;
|
|
418
|
+
var footer = tab === 'export'
|
|
419
|
+
? [
|
|
420
|
+
h('button', { key: 'prompt', type: 'button', className: 'import-conflict-btn', disabled: promptText === null, onClick: copyPrompt }, 'Copy prompt'),
|
|
421
|
+
h('button', { key: 'copy', type: 'button', className: 'import-conflict-btn', disabled: exportDisabled, onClick: copyBundle }, 'Copy to clipboard'),
|
|
422
|
+
h('button', { key: 'md', type: 'button', className: 'import-conflict-btn import-conflict-btn-primary', disabled: exportDisabled, onClick: download }, exp.busy ? 'Building...' : 'Download .md')
|
|
423
|
+
]
|
|
424
|
+
: [
|
|
425
|
+
h('button', {
|
|
426
|
+
key: 'check', type: 'button', className: 'import-conflict-btn',
|
|
427
|
+
disabled: apply.busy || !patch.trim(), onClick: check
|
|
428
|
+
}, 'Check'),
|
|
429
|
+
h('button', {
|
|
430
|
+
key: 'apply', type: 'button', className: 'import-conflict-btn import-conflict-btn-primary',
|
|
431
|
+
disabled: !canApply, onClick: applyPatch
|
|
432
|
+
}, counts ? 'Apply ' + counts.selected + ' of ' + counts.total + ' changes' : 'Apply')
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
var tabButton = function (id, label) {
|
|
436
|
+
return h('button', {
|
|
437
|
+
type: 'button', role: 'tab', 'aria-selected': tab === id,
|
|
438
|
+
className: 'ai-tab' + (tab === id ? ' active' : ''), onClick: function () { setTab(id); }
|
|
439
|
+
}, label);
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
return h(window.ModalDialog, { className: 'schema-modal ai-modal', label: 'AI export and apply', onDismiss: onClose },
|
|
443
|
+
h('div', { className: 'schema-modal-header' },
|
|
444
|
+
h('div', { className: 'ai-tabs', role: 'tablist' }, tabButton('export', 'Export'), tabButton('apply', 'Apply diff'))),
|
|
445
|
+
h('div', { className: 'schema-modal-body' }, tab === 'export' ? exportPane : applyPane),
|
|
446
|
+
h('div', { className: 'import-conflict-actions' },
|
|
447
|
+
h('button', { type: 'button', className: 'import-conflict-btn', onClick: onClose }, 'Close'),
|
|
448
|
+
footer)
|
|
449
|
+
);
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
window.AiRoundTripModal = AiRoundTripModal;
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
return '<h1 class="changelog-h1">' + text + '</h1>\n';
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
renderer.list = function(body, ordered
|
|
56
|
+
renderer.list = function(body, ordered) {
|
|
57
57
|
var tag = ordered ? 'ol' : 'ul';
|
|
58
58
|
var cls = ordered ? '' : ' class="changelog-list"';
|
|
59
59
|
return '<' + tag + cls + '>\n' + body + '</' + tag + '>\n';
|