Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,334 changes: 98 additions & 1,236 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"ws": "^8.21.3"
},
"dependencies": {
"@acode.app/canvas-view": "^0.0.3",
"@codemirror/autocomplete": "^6.20.3",
"@codemirror/commands": "^6.11.0",
"@codemirror/lang-angular": "^0.1.4",
Expand All @@ -98,18 +99,18 @@
"@codemirror/lang-wast": "^6.0.2",
"@codemirror/lang-xml": "^6.1.0",
"@codemirror/lang-yaml": "^6.1.3",
"@codemirror/language": "^6.12.4",
"@codemirror/language": "^6.13.1",
"@codemirror/language-data": "^6.5.2",
"@codemirror/legacy-modes": "^6.5.3",
"@codemirror/lint": "^6.9.7",
"@codemirror/lsp-client": "file:codemirror-lsp-client",
"@codemirror/search": "^6.7.1",
"@codemirror/state": "^6.7.1",
"@codemirror/state": "^6.7.6",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.43.9",
"@codemirror/view": "^6.43.14",
"@deadlyjack/ajax": "^1.2.6",
"@emmetio/codemirror6-plugin": "^0.4.1",
"@lezer/common": "^1.5.2",
"@lezer/common": "^1.5.4",
"@lezer/highlight": "^1.2.5",
"@lezer/lr": "^1.4.10",
"@ungap/custom-elements": "^1.3.0",
Expand Down Expand Up @@ -140,10 +141,10 @@
"markdown-it-github-alerts": "^1.0.1",
"markdown-it-task-lists": "^2.1.1",
"markdown-it-texmath": "^1.0.0",
"mermaid": "^11.14.0",
"mime-types": "^3.0.2",
"motion": "^12.43.0",
"mustache": "^4.2.0",
"pele": "^1.10.0",
"picomatch": "^4.0.7",
"tough-cookie": "^6.0.2",
"url-parse": "^1.5.10",
Expand All @@ -157,12 +158,12 @@
"overrides": {
"@codemirror/autocomplete": "^6.20.3",
"@codemirror/commands": "^6.11.0",
"@codemirror/language": "^6.12.4",
"@codemirror/language": "^6.13.1",
"@codemirror/lint": "^6.9.7",
"@codemirror/search": "^6.7.1",
"@codemirror/state": "^6.7.1",
"@codemirror/view": "^6.43.9",
"@lezer/common": "^1.5.2",
"@codemirror/state": "^6.7.6",
"@codemirror/view": "^6.43.14",
"@lezer/common": "^1.5.4",
"@lezer/lr": "^1.4.10",
"tar": "^7.5.22"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1678,8 +1678,26 @@ private void getAppInfo(Callback callback) {
}

private void openInBrowser(String src, Callback callback) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(src));
activity.startActivity(browserIntent);
if (src == null || src.isEmpty()) {
callback.error("No URL provided.");
return;
}

Uri uri = Uri.parse(src);
if ("file".equalsIgnoreCase(uri.getScheme())) {
// file:// URIs can't leave the app (FileUriExposedException).
callback.error("Cannot open file URI in browser: " + src);
return;
}

try {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
activity.startActivity(browserIntent);
callback.success();
} catch (Exception e) {
Log.e("System", "Failed to open URL: " + src, e);
callback.error(e.getMessage());
}
}

private void launchApp(
Expand Down
35 changes: 29 additions & 6 deletions src/cm/baseExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { history } from "@codemirror/commands";
import {
bracketMatching,
codeFolding as codeFoldingState,
defaultHighlightStyle,
foldGutter,
indentOnInput,
Expand All @@ -31,6 +32,17 @@ import indentationFolding from "./indentationFolding";
export interface BaseExtensionOptions {
autoIndent?: boolean;
codeFolding?: boolean;
/**
* Show CodeMirror's fold gutter with code folding. The canvas renderer
* draws its own fold markers, so it only needs the folding state.
*/
foldGutter?: boolean;
/**
* The canvas renderer draws the selection, cursors, drop cursor, active
* line (and its gutter) and special characters itself, so those
* extensions are left out.
*/
canvas?: boolean;
autoCloseBrackets?: boolean;
bracketMatching?: boolean;
highlightActiveLine?: boolean;
Expand All @@ -46,17 +58,26 @@ export default function createBaseExtensions(
const {
autoIndent = true,
codeFolding = true,
foldGutter: showFoldGutter = true,
canvas = false,
autoCloseBrackets = true,
bracketMatching: enableBracketMatching = true,
highlightActiveLine: enableHighlightActiveLine = true,
highlightSelectionMatches: enableHighlightSelectionMatches = true,
} = options;
const extensions: Extension[] = [highlightSpecialChars(), history()];
const extensions: Extension[] = [history()];
if (!canvas) extensions.push(highlightSpecialChars());

if (enableHighlightActiveLine) extensions.push(highlightActiveLineGutter());
if (codeFolding) extensions.push(foldGutter(), indentationFolding);
extensions.push(drawSelection());
extensions.push(dropCursor());
if (enableHighlightActiveLine && !canvas) {
extensions.push(highlightActiveLineGutter());
}
if (codeFolding) {
extensions.push(
showFoldGutter ? foldGutter() : codeFoldingState(),
indentationFolding,
);
}
if (!canvas) extensions.push(drawSelection(), dropCursor());
extensions.push(EditorState.allowMultipleSelections.of(true));
if (autoIndent) extensions.push(indentOnInput());
extensions.push(
Expand All @@ -66,7 +87,9 @@ export default function createBaseExtensions(
if (autoCloseBrackets) extensions.push(closeBrackets());
extensions.push(rectangularSelection());
extensions.push(crosshairCursor());
if (enableHighlightActiveLine) extensions.push(highlightActiveLine());
if (enableHighlightActiveLine && !canvas) {
extensions.push(highlightActiveLine());
}
if (enableHighlightSelectionMatches) {
extensions.push(highlightSelectionMatches());
}
Expand Down
Loading
Loading