Skip to content

Commit 40da706

Browse files
authored
Merge branch 'main' into ai-agent
2 parents 086bc2d + 51f0fbe commit 40da706

File tree

21 files changed

+853
-39
lines changed

21 files changed

+853
-39
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/universal:2",
3+
"features": {
4+
"ghcr.io/nordcominc/devcontainer-features/android-sdk:1": {}
5+
}
6+
}

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
3838
},
3939
"cordova-sqlite-storage": {},
40+
"cordova-plugin-websocket": {},
4041
"com.foxdebug.acode.exec": {}
4142
},
4243
"platforms": [
@@ -78,6 +79,7 @@
7879
"cordova-plugin-sftp": "file:src/plugins/sftp",
7980
"cordova-plugin-system": "file:src/plugins/system",
8081
"cordova-sqlite-storage": "^7.0.0",
82+
"cordova-plugin-websocket": "file:src/plugins/websocket",
8183
"css-loader": "^7.1.2",
8284
"mini-css-extract-plugin": "^2.9.0",
8385
"path-browserify": "^1.0.1",
@@ -113,6 +115,7 @@
113115
"langchain": "^0.3.27",
114116
"markdown-it": "^14.1.0",
115117
"markdown-it-anchor": "^9.2.0",
118+
"markdown-it-footnote": "^4.0.0",
116119
"markdown-it-github-alerts": "^0.3.0",
117120
"markdown-it-task-lists": "^2.1.1",
118121
"mime-types": "^2.1.35",

src/ace/touchHandler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,9 @@ export default function addTouchListeners(editor, minimal, onclick) {
919919

920920
let { row, column } = renderer.screenToTextCoordinates(x, y);
921921

922-
if (column === start.column) {
923-
++column;
924-
}
922+
// if (column === start.column) {
923+
// ++column;
924+
// }
925925

926926
editor.selection.moveCursorToPosition({ row, column });
927927
positionStart();

src/handlers/editorFileTab.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ let parentRight = 0;
6262
* @type {number}
6363
*/
6464
let animationFrame = null;
65+
/**
66+
* @type {number}
67+
*/
68+
let prevScrollLeft = 0;
6569

6670
const MAX_SCROLL_SPEED = 4;
6771

@@ -126,6 +130,9 @@ export default function startDrag(e) {
126130
document.addEventListener("touchend", releaseDrag, opts);
127131
document.addEventListener("touchcancel", releaseDrag, opts);
128132
document.addEventListener("mouseleave", releaseDrag, opts);
133+
134+
prevScrollLeft = $parent.scrollLeft;
135+
$parent.addEventListener("scroll", preventDefaultScroll, opts);
129136
}
130137

131138
/**
@@ -225,6 +232,12 @@ function releaseDrag(e) {
225232
document.removeEventListener("touchend", releaseDrag, opts);
226233
document.removeEventListener("touchcancel", releaseDrag, opts);
227234
document.removeEventListener("mouseleave", releaseDrag, opts);
235+
236+
$parent.removeEventListener("scroll", preventDefaultScroll);
237+
}
238+
239+
function preventDefaultScroll() {
240+
this.scrollLeft = prevScrollLeft;
228241
}
229242

230243
/**
@@ -236,7 +249,7 @@ function scrollContainer() {
236249
function animate() {
237250
const scroll = getScroll();
238251
if (!scroll) return;
239-
$parent.scrollLeft += scroll;
252+
prevScrollLeft = $parent.scrollLeft += scroll;
240253
animationFrame = requestAnimationFrame(animate);
241254
}
242255
}

src/handlers/intent.js

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import openFile from "lib/openFile";
33
import helpers from "utils/helpers";
44

55
const handlers = [];
6+
/**
7+
* Queue to store intents that arrive before files are restored
8+
* @type {Array<{url: string, options: object}>}
9+
*/
10+
const pendingIntents = [];
611

712
/**
813
*
@@ -39,10 +44,21 @@ export default async function HandleIntent(intent = {}) {
3944
return;
4045
}
4146

42-
await openFile(url, {
43-
mode: "single",
44-
render: true,
45-
});
47+
if (sessionStorage.getItem("isfilesRestored") === "true") {
48+
await openFile(url, {
49+
mode: "single",
50+
render: true,
51+
});
52+
} else {
53+
// Store the intent for later processing when files are restored
54+
pendingIntents.push({
55+
url,
56+
options: {
57+
mode: "single",
58+
render: true,
59+
},
60+
});
61+
}
4662
}
4763
}
4864

@@ -59,6 +75,25 @@ export function removeIntentHandler(handler) {
5975
if (index > -1) handlers.splice(index, 1);
6076
}
6177

78+
/**
79+
* Process all pending intents that were queued before files were restored.
80+
* This function is called after isfilesRestored is set to true in main.js.
81+
* @returns {Promise<void>}
82+
*/
83+
export async function processPendingIntents() {
84+
if (sessionStorage.getItem("isfilesRestored") !== "true") return;
85+
86+
// Process all pending intents
87+
while (pendingIntents.length > 0) {
88+
const pendingIntent = pendingIntents.shift();
89+
try {
90+
await openFile(pendingIntent.url, pendingIntent.options);
91+
} catch (error) {
92+
helpers.error(error);
93+
}
94+
}
95+
}
96+
6297
class IntentEvent {
6398
module;
6499
action;

src/lang/id-id.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
"help": "Bantuan",
188188
"file has been deleted": "{file} telah dihapus!",
189189
"feature not available": "Fitur ini hanya tersedia dalam versi berbayar dari aplikasi.",
190-
"deleted file": "File yang dihapus",
190+
"deleted file": "Berkas yang dihapus",
191191
"line height": "Tinggi baris",
192192
"preview info": "Jika Anda ingin menjalankan berkas aktif, ketuk dan tahan ikon Putar.",
193193
"manage all files": "Izinkan Acode Editor untuk mengelola semua berkas dalam pengaturan untuk mengedit berkas di perangkat Anda dengan mudah.",
@@ -216,12 +216,12 @@
216216
"remember opened folders": "Ingat folder yang dibuka",
217217
"no suggestions": "Tidak ada saran",
218218
"no suggestions aggressive": "Tidak ada saran yang agresif",
219-
"install": "Instal",
220-
"installing": "Menginstal...",
219+
"install": "Pasang",
220+
"installing": "Memasang...",
221221
"plugins": "Plugin",
222222
"recently used": "Baru - baru ini digunakan",
223223
"update": "Perbarui",
224-
"uninstall": "Uninstal",
224+
"uninstall": "Copot pemasangan",
225225
"download acode pro": "Unduh Acode pro",
226226
"loading plugins": "Memuat plugin",
227227
"faqs": "FAQ",
@@ -258,7 +258,7 @@
258258
"preview port": "Port pratinjau",
259259
"find file": "Temukan berkas",
260260
"system": "Sistem",
261-
"please select a formatter": "Mohon pilih formatter",
261+
"please select a formatter": "Mohon pilih pemformat",
262262
"case sensitive": "Sensitif huruf besar",
263263
"regular expression": "Ekspresi Regular",
264264
"whole word": "Seluruh kata",
@@ -269,15 +269,15 @@
269269
"server port": "Port server",
270270
"preview settings": "Pengaturan pratinjau",
271271
"preview settings note": "Jika port pratinjau dan port server berbeda, aplikasi tidak akan memulai server dan sebaliknya akan membuka https://<host>:<pratinjau port> di peramban atau peramban-dalam-aplikasi. Ini berguna ketika Anda menjalankan server di tempat lain.",
272-
"backup/restore note": "Ini hanya akan membuat cadangan pengaturan Anda, tema khusus, plugin yang diinstal, dan binding kunci. Ini tidak akan membuat cadangan FTP/SFTP atau status aplikasi Anda.",
272+
"backup/restore note": "Ini hanya akan membuat cadangan pengaturan Anda, tema khusus, plugin yang dipasang, dan binding kunci. Ini tidak akan membuat cadangan FTP/SFTP atau status aplikasi Anda.",
273273
"host": "Host",
274-
"retry ftp/sftp when fail": "Ulangi ftp/sftp ketika gagal",
274+
"retry ftp/sftp when fail": "Ulangi FTP/SFTP ketika gagal",
275275
"more": "Lebih banyak",
276276
"thank you :)": "Terima kasih :)",
277277
"purchase pending": "Pembelian Tertunda",
278278
"cancelled": "Dibatalkan",
279279
"local": "Lokal",
280-
"remote": "Remote",
280+
"remote": "Jarak Jauh",
281281
"show console toggler": "Tampilkan pengalih konsol",
282282
"binary file": "Berkas ini berisi data biner, apakah Anda ingin membukanya?",
283283
"relative line numbers": "Nomor garis relatif",
@@ -308,7 +308,7 @@
308308
"info-quicktoolstriggermode": "Jika tombol dalam alat cepat tidak berfungsi, cobalah untuk mengubah nilai ini.",
309309
"owned": "Dimiliki",
310310
"api_error": "API server turun, silakan coba setelah beberapa waktu.",
311-
"installed": "Terinstal",
311+
"installed": "Terpasang",
312312
"all": "Semua",
313313
"medium": "Medium",
314314
"refund": "Pengembalian dana",
@@ -388,21 +388,21 @@
388388
"copy uri": "Salin Uri",
389389
"delete entries": "Apakah Anda yakin ingin menghapus {count} item?",
390390
"deleting items": "menghapus {count} item...",
391-
"import project zip": "Impor Proyek(zip)",
391+
"import project zip": "Impor Proyek (zip)",
392392
"changelog": "Catatan Perubahan",
393393
"notifications": "Notifikasi",
394394
"no_unread_notifications": "Tidak ada pemberitahuan yang belum dibaca",
395395
"should_use_current_file_for_preview": "Harus menggunakan berkas saat ini untuk pratinjau alih-alih default (index.html)",
396396
"fade fold widgets": "Widget Lipat Pudar",
397-
"quicktools:home-key": "Home Key",
398-
"quicktools:end-key": "End Key",
399-
"quicktools:pageup-key": "PageUp Key",
400-
"quicktools:pagedown-key": "PageDown Key",
401-
"quicktools:delete-key": "Delete Key",
402-
"quicktools:tilde": "Insert tilde symbol",
403-
"quicktools:backtick": "Insert backtick",
404-
"quicktools:hash": "Insert Hash symbol",
405-
"quicktools:dollar": "Insert dollar symbol",
406-
"quicktools:modulo": "Insert modulo/percent symbol",
407-
"quicktools:caret": "Insert caret symbol"
397+
"quicktools:home-key": "Kunci Home",
398+
"quicktools:end-key": "Kunci End",
399+
"quicktools:pageup-key": "Kunci PageUp",
400+
"quicktools:pagedown-key": "Kunci PageDown",
401+
"quicktools:delete-key": "Kunci Delete",
402+
"quicktools:tilde": "Masukkan tanda gelombang",
403+
"quicktools:backtick": "Masukkan tanda kutip terbalik",
404+
"quicktools:hash": "Masukkan tanda pagar",
405+
"quicktools:dollar": "Masukkan simbol dolar",
406+
"quicktools:modulo": "Masukkan simbol modulus/persen",
407+
"quicktools:caret": "Masukkan tanda sisipan"
408408
}

src/lib/commands.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,17 @@ export default {
358358
if (uri) {
359359
const fs = fsOperation(uri);
360360
try {
361-
const newUri = await fs.renameTo(newname);
361+
let newUri;
362+
if (uri.startsWith("content://com.termux.documents/tree/")) {
363+
// Special handling for Termux content files
364+
const newFilePath = Url.join(Url.dirname(uri), newname);
365+
const content = await fs.readFile();
366+
await fsOperation(Url.dirname(uri)).createFile(newname, content);
367+
await fs.delete();
368+
newUri = newFilePath;
369+
} else {
370+
newUri = await fs.renameTo(newname);
371+
}
362372
const stat = await fsOperation(newUri).stat();
363373

364374
newname = stat.name;

src/lib/editorManager.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,10 @@ async function EditorManager($header, $body) {
676676
actions("set-height", { height: 0, save: false });
677677
} else {
678678
root.classList.remove("hide-floating-button");
679-
const quickToolsHeight = appSettings.value.quickTools || 1;
679+
const quickToolsHeight =
680+
appSettings.value.quickTools !== undefined
681+
? appSettings.value.quickTools
682+
: 1;
680683
actions("set-height", { height: quickToolsHeight, save: true });
681684
}
682685

src/lib/main.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import tile from "components/tile";
1717
import toast from "components/toast";
1818
import tutorial from "components/tutorial";
1919
import fsOperation from "fileSystem";
20-
import intentHandler from "handlers/intent";
20+
import intentHandler, { processPendingIntents } from "handlers/intent";
2121
import keyboardHandler from "handlers/keyboard";
2222
import quickToolsInit from "handlers/quickToolsInit";
2323
import windowResize from "handlers/windowResize";
@@ -481,12 +481,19 @@ async function loadApp() {
481481
if (Array.isArray(files) && files.length) {
482482
try {
483483
await restoreFiles(files);
484+
// save state to handle file loading gracefully
485+
sessionStorage.setItem("isfilesRestored", true);
486+
// Process any pending intents that were queued before files were restored
487+
await processPendingIntents();
484488
} catch (error) {
485489
window.log("error", "File loading failed!");
486490
window.log("error", error);
487491
toast("File loading failed!");
488492
}
489493
} else {
494+
// Even when no files need to be restored, mark as restored and process pending intents
495+
sessionStorage.setItem("isfilesRestored", true);
496+
await processPendingIntents();
490497
onEditorUpdate(undefined, false);
491498
}
492499

0 commit comments

Comments
 (0)