mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-02 04:36:49 +08:00
add form actions to command palette (#5141)
* add form actions to command palette * fix attribute Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
This commit is contained in:
parent
543969e870
commit
2dc5626e70
|
@ -24,7 +24,7 @@
|
||||||
/* exported addMarginBottom */
|
/* exported addMarginBottom */
|
||||||
/* exported enumerateJumpAllFiles */
|
/* exported enumerateJumpAllFiles */
|
||||||
/* exported createRepoCatalogEnumerator */
|
/* exported createRepoCatalogEnumerator */
|
||||||
/* exported enumerateToolbarActions */
|
/* exported enumerateUiActions */
|
||||||
/* exported onDiffCollapse */
|
/* exported onDiffCollapse */
|
||||||
/* exported restoreScrollPosition */
|
/* exported restoreScrollPosition */
|
||||||
|
|
||||||
|
@ -2304,7 +2304,7 @@ function createRepoCatalogEnumerator(catalog, action) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function enumerateToolbarActions() {
|
function enumerateUiActions() {
|
||||||
|
|
||||||
var items = [];
|
var items = [];
|
||||||
function processUL(ulNode, prefix) {
|
function processUL(ulNode, prefix) {
|
||||||
|
@ -2326,6 +2326,7 @@ function enumerateToolbarActions() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// toolbars
|
||||||
[].slice.call(document.querySelectorAll("[id*=toolbar]"))
|
[].slice.call(document.querySelectorAll("[id*=toolbar]"))
|
||||||
.filter(function(toolbar){
|
.filter(function(toolbar){
|
||||||
return (toolbar && toolbar.nodeName === "UL");
|
return (toolbar && toolbar.nodeName === "UL");
|
||||||
|
@ -2333,8 +2334,6 @@ function enumerateToolbarActions() {
|
||||||
processUL(toolbar);
|
processUL(toolbar);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (items.length === 0) return;
|
|
||||||
|
|
||||||
items = items.map(function(item) {
|
items = items.map(function(item) {
|
||||||
var action = "";
|
var action = "";
|
||||||
var anchor = item[0];
|
var anchor = item[0];
|
||||||
|
@ -2352,6 +2351,24 @@ function enumerateToolbarActions() {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// forms
|
||||||
|
[].slice.call(document.querySelectorAll("input[type='submit']"))
|
||||||
|
.forEach(function(input){
|
||||||
|
items.push({
|
||||||
|
action: function(){
|
||||||
|
if ([].slice.call(input.classList).indexOf("main") !== -1){
|
||||||
|
var parentForm = input.parentNode.parentNode.parentNode;
|
||||||
|
if (parentForm.nodeName === "FORM"){
|
||||||
|
parentForm.submit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
submitSapeventForm({}, input.formAction, "post");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: input.value + " " + input.title.replace(/\[.*\]/,"")
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ CLASS zcl_abapgit_gui_page IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD render_command_palettes.
|
METHOD render_command_palettes.
|
||||||
|
|
||||||
ii_html->add( 'var gCommandPalette = new CommandPalette(enumerateToolbarActions, {' ).
|
ii_html->add( 'var gCommandPalette = new CommandPalette(enumerateUiActions, {' ).
|
||||||
ii_html->add( ' toggleKey: "F1",' ).
|
ii_html->add( ' toggleKey: "F1",' ).
|
||||||
ii_html->add( ' hotkeyDescription: "Command ..."' ).
|
ii_html->add( ' hotkeyDescription: "Command ..."' ).
|
||||||
ii_html->add( '});' ).
|
ii_html->add( '});' ).
|
||||||
|
|
|
@ -758,7 +758,8 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
|
||||||
IF is_field-side_action IS NOT INITIAL.
|
IF is_field-side_action IS NOT INITIAL.
|
||||||
ii_html->add( '</div>' ).
|
ii_html->add( '</div>' ).
|
||||||
ii_html->add( '<div class="command-container">' ).
|
ii_html->add( '<div class="command-container">' ).
|
||||||
ii_html->add( |<input type="submit" value="…" formaction="sapevent:{ is_field-side_action }">| ).
|
ii_html->add( |<input type="submit" value="…" formaction="sapevent:{ is_field-side_action }"|
|
||||||
|
&& | title="{ is_field-label }">| ).
|
||||||
ii_html->add( '</div>' ).
|
ii_html->add( '</div>' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user