GitGraph: support open git repo with openwith dialog

This commit is contained in:
lxsang 2022-07-05 22:45:28 +02:00
parent eb7162b901
commit cb76136de3
18 changed files with 28 additions and 414 deletions

View File

@ -1,21 +0,0 @@
# Antedit
Simple yet powerful text/code editor based on the Monaco editor,
the editor that powers VS Code.
The editor functionality can be extended by its extension mechanism.
Extension can be developed/released/isntalled by the editor itself.
### Change logs
- 0.2.2-b: Support horizotal scrolling on horizotal tabbars
- 0.2.1-b: Add open file to right, editor actions are only attached to code editor
- 0.2.0-b: Support diff mode in editor + fix new Monaco version compatible bug
- 0.1.17-b: Fix extension keybinding bug with the new monaco editor
- 0.1.16-b: use the new version of monaco editor
- 0.1.14-b: improve output log display
- 0.1.13-b: Allow file upload in file view, add menu context in tabbar
- 0.1.12-b: fix recent files not adding correctly
- 0.1.11-b: fix file type parsing from path
- 0.1.10-b: Antedit now has it own extension manager
- 0.1.9-a: Allow output text selection
- 0.1.8-a: Allow to change language mode
- 0.1.7-a: Add keyboard shortcut support to extension actions

View File

@ -1,19 +0,0 @@
(function() {
// import the CodePad application module
const App = this.OS.application.Antedit;
// define the extension
App.extensions.{0} = class {0} extends App.EditorBaseExtension {
constructor(app) {
super("{0}",app);
}
test() {
return this.notify("Test action is invoked");
}
cleanup() {}
};
}).call(this);

View File

@ -1,15 +0,0 @@
{
"javascripts": ["{0}.js"],
"copies": [],
"meta": {
"name": "{0}",
"text": "{0}",
"version": "0.0.1-a",
"actions" : [
{
"text": "__(Example action)",
"name": "test"
}
]
}
}

View File

@ -1,33 +0,0 @@
[
{
"name": "EditorExtensionMaker",
"text": "Antedit Extension",
"version": "0.0.1-a",
"actions" : [
{
"text": "__(New Extension)",
"name": "create"
},
{
"text": "__(Build)",
"name": "build"
},
{
"text": "__(Run)",
"name": "run"
},
{
"text": "__(Build release)",
"name": "release"
},
{
"text": "__(Install from file)",
"name": "install"
},
{
"text": "__(Install from URL)",
"name": "installFromURL"
}
]
}
]

View File

@ -1,171 +0,0 @@
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view > div.list-container
{
/*border-top: 1px solid #272822;*/
overflow: hidden;
overflow-x: auto;
font-size: 12px;
scrollbar-width: none;
/*scrollbar-color: #656565 transparent;*/
}
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view > div.list-container::-webkit-scrollbar {
height: 0;
}
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view > div.list-container::-webkit-scrollbar-track {
background: transparent;
}
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view > div.list-container::-webkit-scrollbar-thumb {
background-color: #656565;
border: 0;
}
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view > div.list-container > ul
{
width: intrinsic;
width: -moz-max-content;
width: -webkit-max-content;
width: max-content;
}
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view ul afx-list-item:nth-child(even) li.selected,
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view > div.list-container > ul > afx-list-item > li.selected{
background-color:#272822;
color:white;
border: 0;
border-radius: 0;
}
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view afx-list-view i.closable:before {
color:#afafaf;
}
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view ul afx-list-item:nth-child(even) li,
afx-app-window[data-id = "antedit"] afx-tab-bar> afx-list-view > div.list-container > ul li{
background-color:#333333;
color:#afafaf;
border-radius: 0;
border: 0;
padding-top: 5px;
padding-bottom: 5px;
padding-right: 20px;
border-right: 1px solid #272822;
}
afx-app-window[data-id = "antedit"] afx-tab-container[data-id="sidebar-tab-container"] afx-tab-bar> afx-list-view > div.list-container {
background-color: #333333;
}
afx-app-window[data-id = "antedit"] afx-tab-container[data-id="sidebar-tab-container"] afx-tab-bar> afx-list-view > div.list-container > ul li{
float: none;
font-size: 20px;
}
afx-app-window[data-id = "antedit"] .afx-window-wrapper afx-vbox[data-id = "sidebar"]{
background-color:#272822;
}
afx-app-window[data-id = "antedit"] div.afx-window-content {
background-color:#333333;
}
afx-app-window[data-id = "antedit"] afx-resizer {
background-color:#272822;
border-right: 1px solid #656565;
border-bottom: 1px solid #656565;
}
afx-app-window[data-id = "antedit"] .bottom-tab-content {
background-color:#272822;
}
afx-app-window[data-id = "antedit"] .afx-window-wrapper afx-tree-view{
color: white;
padding: 0;
}
afx-app-window[data-id = "antedit"] .afx-window-wrapper afx-tree-view afx-tree-view-item ul li{
padding-left: 10px;
}
afx-app-window[data-id = "antedit"] .afx-window-wrapper .afx_tree_item_selected ul{
background-color: #116cd6;
}
afx-app-window[data-id = "antedit"] afx-file-view afx-tree-view .afx-tree-view-item:before{
color: white;
}
afx-app-window[data-id = "antedit"] .afx-window-wrapper div[data-id="statctn"]{
color: white;
background-color: #007acc;
padding-right: 10px;
padding-top: 5px;
font-size: 11px;
}
afx-app-window[data-id = "antedit"] .afx-window-wrapper div[data-id="statctn"] afx-label {
padding-left: 10px;
}
afx-app-window[data-id = "antedit"] div[data-id="output-tab"] {
overflow-y: auto;
overflow-x: hidden;
user-select: text;
}
afx-app-window[data-id = "antedit"] div[data-id="output-tab"] pre {
margin: 3px;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
font-family: monospace;
}
afx-app-window[data-id = "antedit"] div[data-id="output-tab"] pre.code-pad-log-error {
color: red;
}
afx-app-window[data-id = "antedit"] div[data-id="output-tab"] pre.code-pad-log-warn {
color: orange;
}
afx-app-window[data-id = "antedit"] div[data-id="output-tab"] pre.code-pad-log-info {
color: white;
}
afx-app-window[data-id = "antedit"] afx-button[ data-id="logger-clear" ] button{
border: 0;
background: transparent;
}
afx-app-window[data-id = "antedit"] afx-antedit-ext-list-item {
color: white !important;
}
afx-app-window[data-id = "antedit"] afx-antedit-ext-list-item afx-label i.label-text{
font-weight: bold !important;
}
afx-app-window[data-id = "antedit"] afx-antedit-ext-list-item p {
margin: 0;
padding: 0;
padding-left:15px;
font-size: 11px;
}
afx-app-window[data-id = "antedit"] afx-antedit-ext-list-item p[data-id="ext-list-item-b-p"] {
text-align: right;
font-size: 11px;
}
afx-app-window[data-id = "antedit"] afx-antedit-ext-list-item > li {
background-color: transparent !important;
padding-right: 5px !important;
}
afx-app-window[data-id = "antedit"] afx-antedit-ext-list-item > li.selected {
background-color: #116cd6 !important;
}
afx-app-window[data-id = "antedit"] afx-antedit-ext-list-item button {
height: 22px;
width: 24px;
padding: 0 !important;
}
afx-app-window[data-id = "antedit"] input[data-id="txt_ext_search"] {
background-color: transparent;
border-radius: 0;
border-color: #333;
color: white;
}

File diff suppressed because one or more lines are too long

View File

@ -1,89 +0,0 @@
{
"pkgname": "Antedit",
"app": "Antedit",
"name": "Antos Editor",
"description": "Antos text/code editor",
"info": {
"author": "Xuan Sang LE",
"email": "mrsang@iohub.dev"
},
"version": "0.2.2-b",
"category": "Development",
"iconclass": "bi bi-journal-code",
"mimes": [
"text/.*",
"[^/]*/json.*",
"[^/]*/.*ml",
"[^/]*/javascript",
"dir"
],
"dependencies": [
"MonacoCore@0.33.0-r"
],
"locale": {
"en_GB": {
"Output": "Output",
"Close tab": "Close tab",
"Close without saving ?": "Close without saving ?",
"Unable to open: {0}": "Unable to open: {0}",
"Unable to save file: {0}": "Unable to save file: {0}",
"Save as": "Save as",
"New extension at": "New extension at",
"Select extension archive": "Select extension archive",
"Current folder is not found": "Current folder is not found",
"Select build directory": "Select build directory",
"Unable to read meta-data": "Unable to read meta-data",
"ExtensionName": "ExtensionName",
"Files generated in {0}": "Files generated in {0}",
"Unable to build extension:{0}": "Unable to build extension:{0}",
"Unable to read meta-data:{0}": "Unable to read meta-data:{0}",
"Invalid extension meta-data": "Invalid extension meta-data",
"Unable to run extension:{0}": "Unable to run extension:{0}",
"Archive created at {0}": "Archive created at {0}",
"Unable to read meta-data: {0}": "Unable to read meta-data: {0}",
"Extension installed": "Extension installed",
"Unable to install extension: {0}": "Unable to install extension: {0}",
"Enter URI": "Enter URI",
"Please enter extension URI:": "Please enter extension URI:",
"Unable to create extension directories: {0}": "Unable to create extension directories: {0}",
"New file": "New file",
"New folder": "New folder",
"Rename": "Rename",
"Delete": "Delete",
"File name": "File name",
"Folder name": "Folder name",
"Quit": "Quit",
"View": "View",
"Toggle bottom bar": "Toggle bottom bar",
"Toggle split view": "Toggle split view",
"Unable to move file/folder": "Unable to move file/folder",
"Editor": "Editor",
"Change language mode": "Change language mode",
"Select language": "Select language",
"Unable to disable split view: Please save changes of modified files on the right panel": "Unable to disable split view: Please save changes of modified files on the right panel",
"File": "File",
"New": "New",
"Open Recent": "Open Recent",
"Open": "Open",
"Open Folder": "Open Folder",
"Save": "Save",
"Fail to create: {0}": "Fail to create: {0}",
"Fail to rename: {0}": "Fail to rename: {0}",
"Fail to delete: {0}": "Fail to delete: {0}",
"Open file": "Open file",
"Open folder": "Open folder",
"Cannot load extension meta data": "Cannot load extension meta data",
"unable to load extension: {0}": "unable to load extension: {0}",
"Unable to find extension: {0}": "Unable to find extension: {0}",
"Unable to find action: {0}": "Unable to find action: {0}",
"Unable to preload extension": "Unable to preload extension",
"Example action": "Example action",
"New Extension": "New Extension",
"Build": "Build",
"Run": "Run",
"Build release": "Build release",
"Install extension from file": "Install extension from file",
"Install extension from URL": "Install extension from URL"
}
}
}

View File

@ -1,54 +0,0 @@
<afx-app-window apptitle="Antos Editor" width="600" height="400" data-id="antedit">
<afx-vbox>
<afx-hbox data-id="wrapper">
<afx-vbox data-width = "200" min-width="200" data-id = "sidebar">
<afx-tab-container data-id="sidebar-tab-container" dir="row" tabbarwidth="30">
<!--File tab-->
<afx-hbox data-height="100%" iconclass="bi bi-files" >
<afx-vbox>
<div data-height="5"></div>
<afx-file-view chdir="false" data-id = "fileview" view="tree" status = "false">
</afx-file-view>
</afx-vbox>
</afx-hbox>
<!--extension tab-->
<afx-hbox data-height="100%" iconclass="bi bi-puzzle" >
<afx-vbox>
<input data-id="txt_ext_search" type="text" data-height="23">
<afx-list-view data-id="extension-list"></afx-list-view>
</afx-vbox>
</afx-hbox>
</afx-tab-container>
</afx-vbox>
<afx-resizer data-width = "3" ></afx-resizer>
<afx-vbox data-id="editor-main-container">
<afx-hbox>
<afx-vbox data-id="left-panel">
<afx-tab-bar closable="true" data-height="26" data-id = "left-tabbar"></afx-tab-bar>
<div data-id="left-editorarea"></div>
</afx-vbox>
<afx-resizer data-width="3"></afx-resizer>
<afx-vbox data-id="right-panel">
<afx-tab-bar closable="true" data-height="26" data-id = "right-tabbar"></afx-tab-bar>
<div data-id="right-editorarea"></div>
</afx-vbox>
</afx-hbox>
<afx-resizer data-height = "3" dir = "ve" attachnext = "true" ></afx-resizer>
<afx-tab-container data-id = "bottombar" data-height="150" min-height="150" tabbarheight= "22">
<afx-hbox tabname="__(Output)" iconclass = "fa fa-file-text" class = "bottom-tab-content">
<afx-button text = "" data-id="logger-clear" iconclass="fa fa-trash" data-width="21"></afx-button>
<div data-id="output-tab" iconclass = "fa fa-file-text" >
</div>
</afx-hbox>
</afx-tab-container>
</afx-vbox>
</afx-hbox>
<div data-height="20" data-id="statctn">
<afx-label text=" " data-id = "current-file-lbl" style="float:left;"></afx-label>
<afx-label data-id="langstat" style="float:right; padding-right: 10px;"></afx-label>
<afx-label data-id="editorstat" style="float:right;"></afx-label>
</div>
</afx-vbox>
</afx-app-window>

View File

@ -107,7 +107,7 @@ namespace OS {
}
private gen_color(x:number): string
{
let n = x + 11;
let n = x + 10;
const rgb = [0, 0, 0];
for (let i = 0; i < 24; i++) {
rgb[i%3] <<= 1;

View File

@ -14,6 +14,7 @@ graph.base_dir = "home://workspace/repo-git";
```
## Change logs:
- v0.1.3-b: Support open Git repo with open with dialog
- v0.1.2-b: fix init bug
- v0.1.1-b: add class to container element
- v0.1.0-b: Initial version

View File

@ -14,6 +14,7 @@ graph.base_dir = "home://workspace/repo-git";
```
## Change logs:
- v0.1.3-b: Support open Git repo with open with dialog
- v0.1.2-b: fix init bug
- v0.1.1-b: add class to container element
- v0.1.0-b: Initial version

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
var OS;!function(t){let i,e;i=t.API||(t.API={}),function(t){class e extends t.BaseApplication{constructor(t){super("GitGraph",t)}main(){const t=new i.LibGitGraph({target:this.find("git-graph")});t.on_open_diff=t=>{this._gui.launch("Antedit",[]).then(i=>{i.observable.one("launched",()=>i.openDiff(t))}).catch(t=>this.error(__("Unable to open diff with Antedit: {0}",t.toString()),t))},this.find("btn-open").onbtclick=i=>{this.openDialog("FileDialog",{title:__("Select a repository"),type:"dir"}).then(i=>{this.find("txt-repo").text=i.file.path,t.base_dir=i.file})}}}t.GitGraph=e,e.dependencies=["pkg://GitGraph/libgitgraph.js"]}(e=t.application||(t.application={}))}(OS||(OS={}));
var OS;!function(t){let i,e;i=t.API||(t.API={}),function(t){class e extends t.BaseApplication{constructor(t){super("GitGraph",t),t&&t[0]&&(this.curr_repo=t[0].path.asFileHandle(),"file"===t[0].type&&(this.curr_repo=this.curr_repo.parent()))}main(){this.graph=new i.LibGitGraph({target:this.find("git-graph")}),this.graph.on_open_diff=t=>{this._gui.launch("Antedit",[]).then(i=>{i.observable.one("launched",()=>i.openDiff(t))}).catch(t=>this.error(__("Unable to open diff with Antedit: {0}",t.toString()),t))},this.find("btn-open").onbtclick=t=>{this.openDialog("FileDialog",{title:__("Select a repository"),type:"dir"}).then(t=>{this.setRepo(t.file)})},this.setRepo(this.curr_repo)}setRepo(t){t&&(this.find("txt-repo").text=t.path,this.curr_repo=t,this.graph.base_dir=t)}}t.GitGraph=e,e.dependencies=["pkg://GitGraph/libgitgraph.js"]}(e=t.application||(t.application={}))}(OS||(OS={}));

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.2-a",
"version":"0.1.3-b",
"category":"Development",
"iconclass":"bi bi-git",
"mimes":["dir"],

Binary file not shown.

View File

@ -18,14 +18,22 @@ namespace OS {
* @extends {BaseApplication}
*/
export class GitGraph extends BaseApplication {
private graph: API.LibGitGraph;
private curr_repo: API.VFS.BaseFileHandle;
constructor(args: AppArgumentsType[]) {
super("GitGraph", args);
if(args && args[0])
{
this.curr_repo = args[0].path.asFileHandle();
if(args[0].type === "file")
this.curr_repo = this.curr_repo.parent();
}
}
main(): void {
const graph = new API.LibGitGraph({
this.graph = new API.LibGitGraph({
target: this.find("git-graph")
});
graph.on_open_diff = (files) => {
this.graph.on_open_diff = (files) => {
this._gui.launch("Antedit", [])
.then((p) =>{
p.observable.one("launched",() =>(p as any).openDiff(files));
@ -39,11 +47,18 @@ namespace OS {
type: "dir",
}).then((d) => {
(this.find("txt-repo") as GUI.tag.LabelTag).text = d.file.path;
graph.base_dir = d.file;
this.setRepo(d.file);
});
};
this.setRepo(this.curr_repo);
}
private setRepo(d:API.VFS.BaseFileHandle): void
{
if(!d) return;
(this.find("txt-repo") as GUI.tag.LabelTag).text = d.path;
this.curr_repo = d;
this.graph.base_dir = d;
}
}

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.2-a",
"version":"0.1.3-b",
"category":"Development",
"iconclass":"bi bi-git",
"mimes":["dir"],

View File

@ -165,7 +165,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/GitGraph/README.md",
"category": "Development",
"author": "Dany LE",
"version": "0.1.2-a",
"version": "0.1.3-b",
"dependencies": [],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/GitGraph/build/release/GitGraph.zip"
},