mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
data-contextmenu-id -> data-contextmenu
This commit is contained in:
+1
-1
@@ -67,6 +67,6 @@ TBD
|
||||
|
||||
Context menus are contextual menus that are shown when the user right clicks on an element. Creating a context menu is the same as creating a standard menu , by using `app.NewMenu()`. To make the context menu available to a window, call `window.RegisterContextMenu(name, menu)`. The name will be the id of the context menu and used by the frontend.
|
||||
|
||||
To indicate that an element has a context menu, add the `data-contextmenu-id` attribute to the element. The value of this attribute should be the name of a context menu previously registered with the window.
|
||||
To indicate that an element has a context menu, add the `data-contextmenu` attribute to the element. The value of this attribute should be the name of a context menu previously registered with the window.
|
||||
|
||||
It is possible to register a context menu at the application level, making it available to all windows. This can be done using `app.RegisterContextMenu(name, menu)`. If a context menu cannot be found at the window level, the application context menus will be checked. A demo of this can be found in `v3/examples/contextmenus`.
|
||||
@@ -9,13 +9,13 @@
|
||||
<body>
|
||||
<h1>Events Demo</h1>
|
||||
<br/>
|
||||
<div class="file" id="123abc" data-contextmenu-id="test" data-contextmenu-data="1" draggable="true" ondragstart="dragstart()" ondragend="dragend()">
|
||||
<div class="file" id="123abc" data-contextmenu="test" data-contextmenu-data="1" draggable="true" ondragstart="dragstart()" ondragend="dragend()">
|
||||
<h1>1</h1>
|
||||
</div>
|
||||
<div class="file" id="234abc" data-contextmenu-id="test" data-contextmenu-data="2" draggable="true" ondragstart="dragstart()" ondragend="dragend()">
|
||||
<div class="file" id="234abc" data-contextmenu="test" data-contextmenu-data="2" draggable="true" ondragstart="dragstart()" ondragend="dragend()">
|
||||
<h1>2</h1>
|
||||
</div>
|
||||
<div class="file" id="345abc" data-contextmenu-id="test" data-contextmenu-data="3" draggable="true" ondragstart="dragstart()" ondragend="dragend()">
|
||||
<div class="file" id="345abc" data-contextmenu="test" data-contextmenu-data="3" draggable="true" ondragstart="dragstart()" ondragend="dragend()">
|
||||
<h1>3</h1>
|
||||
</div>
|
||||
<div id="results"></div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<body>
|
||||
<h1>Events Demo</h1>
|
||||
<br/>
|
||||
<div class="file" id="123abc" data-contextmenu-id="f" data-contextmenu-data="someid" draggable="true" ondragstart="dragstart()" ondragend="dragend()"></div>
|
||||
<div class="file" id="123abc" data-contextmenu="f" data-contextmenu-data="someid" draggable="true" ondragstart="dragstart()" ondragend="dragend()"></div>
|
||||
<div class="file" id="234abc" draggable="true" ondragstart="dragstart()" ondragend="dragend()"></div>
|
||||
<div class="file" id="345abc" draggable="true" ondragstart="dragstart()" ondragend="dragend()"></div>
|
||||
<div id="results"></div>
|
||||
|
||||
@@ -19,7 +19,7 @@ function contextMenuHandler(event) {
|
||||
}
|
||||
|
||||
function processContextMenu(element, event) {
|
||||
let id = element.getAttribute('data-contextmenu-id');
|
||||
let id = element.getAttribute('data-contextmenu');
|
||||
if (id) {
|
||||
event.preventDefault();
|
||||
openContextMenu(id, event.clientX, event.clientY, element.getAttribute('data-contextmenu-data'));
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
processContextMenu(event.target, event);
|
||||
}
|
||||
function processContextMenu(element, event) {
|
||||
let id = element.getAttribute("data-contextmenu-id");
|
||||
let id = element.getAttribute("data-contextmenu");
|
||||
if (id) {
|
||||
event.preventDefault();
|
||||
openContextMenu(id, event.clientX, event.clientY, element.getAttribute("data-contextmenu-data"));
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
processContextMenu(event.target, event);
|
||||
}
|
||||
function processContextMenu(element, event) {
|
||||
let id = element.getAttribute("data-contextmenu-id");
|
||||
let id = element.getAttribute("data-contextmenu");
|
||||
if (id) {
|
||||
event.preventDefault();
|
||||
openContextMenu(id, event.clientX, event.clientY, element.getAttribute("data-contextmenu-data"));
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
processContextMenu(event.target, event);
|
||||
}
|
||||
function processContextMenu(element, event) {
|
||||
let id = element.getAttribute("data-contextmenu-id");
|
||||
let id = element.getAttribute("data-contextmenu");
|
||||
if (id) {
|
||||
event.preventDefault();
|
||||
openContextMenu(id, event.clientX, event.clientY, element.getAttribute("data-contextmenu-data"));
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user