mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 23:39:21 +08:00
Context menu WIP
options refactor
This commit is contained in:
parent
cd1e3f5bb0
commit
f951b51c11
@ -7,13 +7,12 @@ import (
|
|||||||
"github.com/wailsapp/wails/v3/examples/binding/services"
|
"github.com/wailsapp/wails/v3/examples/binding/services"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type localStruct struct{}
|
type localStruct struct{}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Bind: []interface{}{
|
Bind: []interface{}{
|
||||||
&localStruct{},
|
&localStruct{},
|
||||||
&services.GreetService{},
|
&services.GreetService{},
|
||||||
|
@ -9,18 +9,16 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/events"
|
"github.com/wailsapp/wails/v3/pkg/events"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "WebviewWindow Demo",
|
Name: "WebviewWindow Demo",
|
||||||
Description: "A demo of the WebviewWindow API",
|
Description: "A demo of the WebviewWindow API",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -67,45 +65,45 @@ func main() {
|
|||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
myMenu.Add("New WebviewWindow (TitleBarHiddenInset)").
|
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInset)").
|
||||||
OnClick(func(ctx *application.Context) {
|
OnClick(func(ctx *application.Context) {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
InvisibleTitleBarHeight: 25,
|
InvisibleTitleBarHeight: 25,
|
||||||
},
|
},
|
||||||
}).
|
}).
|
||||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||||
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
||||||
SetHTML("<br/><br/><p>A TitleBarHiddenInset WebviewWindow example</p>").
|
SetHTML("<br/><br/><p>A MacTitleBarHiddenInset WebviewWindow example</p>").
|
||||||
Show()
|
Show()
|
||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
myMenu.Add("New WebviewWindow (TitleBarHiddenInsetUnified)").
|
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInsetUnified)").
|
||||||
OnClick(func(ctx *application.Context) {
|
OnClick(func(ctx *application.Context) {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
TitleBar: options.TitleBarHiddenInsetUnified,
|
TitleBar: application.MacTitleBarHiddenInsetUnified,
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
},
|
},
|
||||||
}).
|
}).
|
||||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||||
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
||||||
SetHTML("<br/><br/><p>A TitleBarHiddenInsetUnified WebviewWindow example</p>").
|
SetHTML("<br/><br/><p>A MacTitleBarHiddenInsetUnified WebviewWindow example</p>").
|
||||||
Show()
|
Show()
|
||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
myMenu.Add("New WebviewWindow (TitleBarHidden)").
|
myMenu.Add("New WebviewWindow (MacTitleBarHidden)").
|
||||||
OnClick(func(ctx *application.Context) {
|
OnClick(func(ctx *application.Context) {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
TitleBar: options.TitleBarHidden,
|
TitleBar: application.MacTitleBarHidden,
|
||||||
InvisibleTitleBarHeight: 25,
|
InvisibleTitleBarHeight: 25,
|
||||||
},
|
},
|
||||||
}).
|
}).
|
||||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||||
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
||||||
SetHTML("<br/><br/><p>A TitleBarHidden WebviewWindow example</p>").
|
SetHTML("<br/><br/><p>A MacTitleBarHidden WebviewWindow example</p>").
|
||||||
Show()
|
Show()
|
||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
|
@ -5,17 +5,15 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "Clipboard Demo",
|
Name: "Clipboard Demo",
|
||||||
Description: "A demo of the clipboard API",
|
Description: "A demo of the clipboard API",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -7,17 +7,15 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "Dialogs Demo",
|
Name: "Dialogs Demo",
|
||||||
Description: "A demo of the dialogs API",
|
Description: "A demo of the dialogs API",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -4,18 +4,36 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Title</title>
|
<title>Title</title>
|
||||||
<style>body{ text-align: center; color: white; background-color: rgba(0,0,0,0); user-select: none; -ms-user-select: none; -webkit-user-select: none; }</style>
|
<style>body{ text-align: center; color: white; background-color: rgba(0,0,0,0); user-select: none; -ms-user-select: none; -webkit-user-select: none; }</style>
|
||||||
|
<style>.file{ width: 100px; height: 100px; border: 3px solid black; }</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Events Demo</h1>
|
<h1>Events Demo</h1>
|
||||||
<br/>
|
<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="234abc" draggable="true" ondragstart="dragstart()" ondragend="dragend()"></div>
|
||||||
|
<div class="file" id="345abc" draggable="true" ondragstart="dragstart()" ondragend="dragend()"></div>
|
||||||
<div id="results"></div>
|
<div id="results"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
wails.Events.On("myevent", function(data) {
|
wails.Events.On("myevent", function(data) {
|
||||||
let currentHTML = document.getElementById("results").innerHTML;
|
let currentHTML = document.getElementById("results").innerHTML;
|
||||||
document.getElementById("results").innerHTML = currentHTML + "<br/>" + JSON.stringify(data);;
|
document.getElementById("results").innerHTML = currentHTML + "<br/>" + JSON.stringify(data);
|
||||||
})
|
})
|
||||||
|
window.addEventListener("dragstart", (event) =>
|
||||||
|
event.dataTransfer.setData("text/plain", "This text may be dragged")
|
||||||
|
);
|
||||||
|
window.addEventListener("contextmenu", (event) => {
|
||||||
|
console.log({event})
|
||||||
|
let element = event.target;
|
||||||
|
let contextMenuId = element.getAttribute("data-contextmenu-id");
|
||||||
|
if (contextMenuId) {
|
||||||
|
let contextMenuData = element.getAttribute("data-contextmenu-data");
|
||||||
|
console.log({contextMenuId, contextMenuData, x: event.clientX, y: event.clientY});
|
||||||
|
_wails.openContextMenu(contextMenuId, event.clientX, event.clientY, contextMenuData);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -6,11 +6,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/events"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/events"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed assets
|
//go:embed assets
|
||||||
@ -18,10 +15,10 @@ var assets embed.FS
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "Events Demo",
|
Name: "Events Demo",
|
||||||
Description: "A demo of the Events API",
|
Description: "A demo of the Events API",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -41,25 +38,25 @@ func main() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Events Demo",
|
Title: "Events Demo",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInsetUnified,
|
TitleBar: application.MacTitleBarHiddenInsetUnified,
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Events Demo",
|
Title: "Events Demo",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInsetUnified,
|
TitleBar: application.MacTitleBarHiddenInsetUnified,
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -8,14 +8,13 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "Menu Demo",
|
Name: "Menu Demo",
|
||||||
Description: "A demo of the menu system",
|
Description: "A demo of the menu system",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -110,22 +109,22 @@ func main() {
|
|||||||
mySystray.SetMenu(myMenu)
|
mySystray.SetMenu(myMenu)
|
||||||
mySystray.SetIconPosition(application.NSImageLeading)
|
mySystray.SetIconPosition(application.NSImageLeading)
|
||||||
|
|
||||||
myWindow := app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
myWindow := app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Kitchen Sink",
|
Title: "Kitchen Sink",
|
||||||
Width: 600,
|
Width: 600,
|
||||||
Height: 400,
|
Height: 400,
|
||||||
AlwaysOnTop: true,
|
AlwaysOnTop: true,
|
||||||
DisableResize: false,
|
DisableResize: false,
|
||||||
BackgroundColour: &options.RGBA{
|
BackgroundColour: &application.RGBA{
|
||||||
Red: 255,
|
Red: 255,
|
||||||
Green: 255,
|
Green: 255,
|
||||||
Blue: 255,
|
Blue: 255,
|
||||||
Alpha: 30,
|
Alpha: 30,
|
||||||
},
|
},
|
||||||
StartState: options.WindowStateMaximised,
|
StartState: application.WindowStateMaximised,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
Appearance: options.NSAppearanceNameDarkAqua,
|
Appearance: application.NSAppearanceNameDarkAqua,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
/*
|
/*
|
||||||
@ -185,14 +184,14 @@ func main() {
|
|||||||
*/
|
*/
|
||||||
var myWindow2 *application.WebviewWindow
|
var myWindow2 *application.WebviewWindow
|
||||||
var myWindow2Lock sync.RWMutex
|
var myWindow2Lock sync.RWMutex
|
||||||
myWindow2 = app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
myWindow2 = app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "#2",
|
Title: "#2",
|
||||||
Width: 1024,
|
Width: 1024,
|
||||||
Height: 768,
|
Height: 768,
|
||||||
AlwaysOnTop: false,
|
AlwaysOnTop: false,
|
||||||
URL: "https://google.com",
|
URL: "https://google.com",
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
//myWindow2.On(events.Mac.WindowDidMove, func() {
|
//myWindow2.On(events.Mac.WindowDidMove, func() {
|
||||||
|
@ -4,17 +4,15 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "Menu Demo",
|
Name: "Menu Demo",
|
||||||
Description: "A demo of the menu system",
|
Description: "A demo of the menu system",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,31 +5,29 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "Plain",
|
Name: "Plain",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(`<html><head><title>Plain Bundle</title></head><body><div class="main"><h1>Plain Bundle</h1><p>This is a plain bundle. It has no frontend code but this was Served by the AssetServer's Handler</p></div></body></html>`))
|
w.Write([]byte(`<html><head><title>Plain Bundle</title></head><body><div class="main"><h1>Plain Bundle</h1><p>This is a plain bundle. It has no frontend code but this was Served by the AssetServer's Handler</p></div></body></html>`))
|
||||||
|
@ -5,17 +5,15 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "Systray Demo",
|
Name: "Systray Demo",
|
||||||
Description: "A demo of the Systray API",
|
Description: "A demo of the Systray API",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ActivationPolicy: options.ActivationPolicyAccessory,
|
ActivationPolicy: application.ActivationPolicyAccessory,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -9,18 +9,16 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/events"
|
"github.com/wailsapp/wails/v3/pkg/events"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "WebviewWindow Demo",
|
Name: "WebviewWindow Demo",
|
||||||
Description: "A demo of the WebviewWindow API",
|
Description: "A demo of the WebviewWindow API",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -58,56 +56,56 @@ func main() {
|
|||||||
myMenu.Add("New Frameless WebviewWindow").
|
myMenu.Add("New Frameless WebviewWindow").
|
||||||
SetAccelerator("CmdOrCtrl+F").
|
SetAccelerator("CmdOrCtrl+F").
|
||||||
OnClick(func(ctx *application.Context) {
|
OnClick(func(ctx *application.Context) {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
X: rand.Intn(1000),
|
X: rand.Intn(1000),
|
||||||
Y: rand.Intn(800),
|
Y: rand.Intn(800),
|
||||||
Frameless: true,
|
Frameless: true,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
},
|
},
|
||||||
}).Show()
|
}).Show()
|
||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
myMenu.Add("New WebviewWindow (TitleBarHiddenInset)").
|
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInset)").
|
||||||
OnClick(func(ctx *application.Context) {
|
OnClick(func(ctx *application.Context) {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
InvisibleTitleBarHeight: 25,
|
InvisibleTitleBarHeight: 25,
|
||||||
},
|
},
|
||||||
}).
|
}).
|
||||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||||
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
||||||
SetHTML("<br/><br/><p>A TitleBarHiddenInset WebviewWindow example</p>").
|
SetHTML("<br/><br/><p>A MacTitleBarHiddenInset WebviewWindow example</p>").
|
||||||
Show()
|
Show()
|
||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
myMenu.Add("New WebviewWindow (TitleBarHiddenInsetUnified)").
|
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInsetUnified)").
|
||||||
OnClick(func(ctx *application.Context) {
|
OnClick(func(ctx *application.Context) {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
TitleBar: options.TitleBarHiddenInsetUnified,
|
TitleBar: application.MacTitleBarHiddenInsetUnified,
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
},
|
},
|
||||||
}).
|
}).
|
||||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||||
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
||||||
SetHTML("<br/><br/><p>A TitleBarHiddenInsetUnified WebviewWindow example</p>").
|
SetHTML("<br/><br/><p>A MacTitleBarHiddenInsetUnified WebviewWindow example</p>").
|
||||||
Show()
|
Show()
|
||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
myMenu.Add("New WebviewWindow (TitleBarHidden)").
|
myMenu.Add("New WebviewWindow (MacTitleBarHidden)").
|
||||||
OnClick(func(ctx *application.Context) {
|
OnClick(func(ctx *application.Context) {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
TitleBar: options.TitleBarHidden,
|
TitleBar: application.MacTitleBarHidden,
|
||||||
InvisibleTitleBarHeight: 25,
|
InvisibleTitleBarHeight: 25,
|
||||||
},
|
},
|
||||||
}).
|
}).
|
||||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||||
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
SetPosition(rand.Intn(1000), rand.Intn(800)).
|
||||||
SetHTML("<br/><br/><p>A TitleBarHidden WebviewWindow example</p>").
|
SetHTML("<br/><br/><p>A MacTitleBarHidden WebviewWindow example</p>").
|
||||||
Show()
|
Show()
|
||||||
windowCounter++
|
windowCounter++
|
||||||
})
|
})
|
||||||
|
@ -7,8 +7,6 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,11 +14,11 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "WebviewWindow Javascript Demo",
|
Name: "WebviewWindow Javascript Demo",
|
||||||
Description: "A demo of the WebviewWindow API from Javascript",
|
Description: "A demo of the WebviewWindow API from Javascript",
|
||||||
Icon: nil,
|
Icon: nil,
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -32,8 +30,8 @@ func main() {
|
|||||||
windowCounter := 1
|
windowCounter := 1
|
||||||
|
|
||||||
newWindow := func() {
|
newWindow := func() {
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
}).
|
}).
|
||||||
|
@ -115,7 +115,7 @@ func findApplicationNewCalls(context *Context) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check struct literal is of type "options.Application"
|
// Check struct literal is of type "application.Options"
|
||||||
selectorExpr, ok := structLit.Type.(*ast.SelectorExpr)
|
selectorExpr, ok := structLit.Type.(*ast.SelectorExpr)
|
||||||
if !ok {
|
if !ok {
|
||||||
return true
|
return true
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GreetService struct {
|
type GreetService struct {
|
||||||
@ -22,7 +21,7 @@ type OtherService struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Bind: []interface{}{
|
Bind: []interface{}{
|
||||||
&GreetService{},
|
&GreetService{},
|
||||||
&OtherService{},
|
&OtherService{},
|
||||||
|
@ -5,11 +5,10 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Bind: []interface{}{
|
Bind: []interface{}{
|
||||||
&GreetService{},
|
&GreetService{},
|
||||||
&OtherService{},
|
&OtherService{},
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GreetService struct {
|
type GreetService struct {
|
||||||
@ -18,7 +17,7 @@ func (*GreetService) Greet(name string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Bind: []interface{}{
|
Bind: []interface{}{
|
||||||
&GreetService{},
|
&GreetService{},
|
||||||
},
|
},
|
||||||
|
28
v3/internal/runtime/desktop/contextmenu.js
Normal file
28
v3/internal/runtime/desktop/contextmenu.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import {newRuntimeCaller} from "./runtime";
|
||||||
|
|
||||||
|
let call = newRuntimeCaller("contextmenu");
|
||||||
|
|
||||||
|
function openContextMenu(id, x, y, data) {
|
||||||
|
return call("OpenContextMenu", {id, x, y, data});
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableContextMenus(enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
window.addEventListener('contextmenu', contextMenuHandler);
|
||||||
|
} else {
|
||||||
|
window.removeEventListener('contextmenu', contextMenuHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function contextMenuHandler(e) {
|
||||||
|
let element = e.target;
|
||||||
|
let contextMenuId = element.getAttribute("data-contextmenu-id");
|
||||||
|
if (contextMenuId) {
|
||||||
|
let contextMenuData = element.getAttribute("data-contextmenu-data");
|
||||||
|
console.log({contextMenuId, contextMenuData, x: e.clientX, y: e.clientY});
|
||||||
|
e.preventDefault();
|
||||||
|
return openContextMenu(contextMenuId, e.clientX, e.clientY, contextMenuData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enableContextMenus(true);
|
@ -9,7 +9,6 @@ The electron alternative for Go
|
|||||||
*/
|
*/
|
||||||
/* jshint esversion: 9 */
|
/* jshint esversion: 9 */
|
||||||
|
|
||||||
import {dialogCallback, dialogErrorCallback, Error, Info, OpenFile, Question, SaveFile, Warning,} from "./dialogs";
|
|
||||||
|
|
||||||
import * as Clipboard from './clipboard';
|
import * as Clipboard from './clipboard';
|
||||||
import * as Application from './application';
|
import * as Application from './application';
|
||||||
@ -17,12 +16,13 @@ import * as Log from './log';
|
|||||||
|
|
||||||
import {newWindow} from "./window";
|
import {newWindow} from "./window";
|
||||||
import {dispatchCustomEvent, Emit, Off, OffAll, On, Once, OnMultiple} from "./events";
|
import {dispatchCustomEvent, Emit, Off, OffAll, On, Once, OnMultiple} from "./events";
|
||||||
|
import {dialogCallback, dialogErrorCallback, Error, Info, OpenFile, Question, SaveFile, Warning,} from "./dialogs";
|
||||||
|
|
||||||
// Internal wails endpoints
|
|
||||||
window.wails = {
|
window.wails = {
|
||||||
...newRuntime(-1),
|
...newRuntime(-1),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Internal wails endpoints
|
||||||
window._wails = {
|
window._wails = {
|
||||||
dialogCallback,
|
dialogCallback,
|
||||||
dialogErrorCallback,
|
dialogErrorCallback,
|
||||||
@ -63,3 +63,4 @@ if (DEBUG) {
|
|||||||
console.log("Wails v3.0.0 Debug Mode Enabled");
|
console.log("Wails v3.0.0 Debug Mode Enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
16
v3/internal/runtime/package-lock.json
generated
16
v3/internal/runtime/package-lock.json
generated
@ -13,6 +13,7 @@
|
|||||||
"happy-dom": "^8.1.5",
|
"happy-dom": "^8.1.5",
|
||||||
"nanoid": "^4.0.0",
|
"nanoid": "^4.0.0",
|
||||||
"npm-check-updates": "^16.6.3",
|
"npm-check-updates": "^16.6.3",
|
||||||
|
"svelte": "^3.55.1",
|
||||||
"vitest": "^0.28.3"
|
"vitest": "^0.28.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4408,6 +4409,15 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/svelte": {
|
||||||
|
"version": "3.55.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.55.1.tgz",
|
||||||
|
"integrity": "sha512-S+87/P0Ve67HxKkEV23iCdAh/SX1xiSfjF1HOglno/YTbSTW7RniICMCofWGdJJbdjw3S+0PfFb1JtGfTXE0oQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.1.13",
|
"version": "6.1.13",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz",
|
||||||
@ -8185,6 +8195,12 @@
|
|||||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"svelte": {
|
||||||
|
"version": "3.55.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.55.1.tgz",
|
||||||
|
"integrity": "sha512-S+87/P0Ve67HxKkEV23iCdAh/SX1xiSfjF1HOglno/YTbSTW7RniICMCofWGdJJbdjw3S+0PfFb1JtGfTXE0oQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"tar": {
|
"tar": {
|
||||||
"version": "6.1.13",
|
"version": "6.1.13",
|
||||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz",
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"happy-dom": "^8.1.5",
|
"happy-dom": "^8.1.5",
|
||||||
"nanoid": "^4.0.0",
|
"nanoid": "^4.0.0",
|
||||||
"npm-check-updates": "^16.6.3",
|
"npm-check-updates": "^16.6.3",
|
||||||
|
"svelte": "^3.55.1",
|
||||||
"vitest": "^0.28.3"
|
"vitest": "^0.28.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
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
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -5,8 +5,6 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,25 +12,25 @@ import (
|
|||||||
var assets embed.FS
|
var assets embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := application.New(options.Application{
|
app := application.New(application.Options{
|
||||||
Name: "{{.ProjectName}}",
|
Name: "{{.ProjectName}}",
|
||||||
Description: "A demo of using raw HTML & CSS",
|
Description: "A demo of using raw HTML & CSS",
|
||||||
Mac: options.Mac{
|
Mac: application.MacOptions{
|
||||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Create window
|
// Create window
|
||||||
app.NewWebviewWindowWithOptions(&options.WebviewWindow{
|
app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
|
||||||
Title: "Plain Bundle",
|
Title: "Plain Bundle",
|
||||||
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
CSS: `body { background-color: rgba(255, 255, 255, 0); } .main { color: white; margin: 20%; }`,
|
||||||
Mac: options.MacWindow{
|
Mac: application.MacWindow{
|
||||||
InvisibleTitleBarHeight: 50,
|
InvisibleTitleBarHeight: 50,
|
||||||
Backdrop: options.MacBackdropTranslucent,
|
Backdrop: application.MacBackdropTranslucent,
|
||||||
TitleBar: options.TitleBarHiddenInset,
|
TitleBar: application.MacTitleBarHiddenInset,
|
||||||
},
|
},
|
||||||
|
|
||||||
URL: "/",
|
URL: "/",
|
||||||
Assets: options.Assets{
|
Assets: application.AssetOptions{
|
||||||
FS: assets,
|
FS: assets,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1,22 +1,17 @@
|
|||||||
//go:build darwin
|
//go:build darwin
|
||||||
|
|
||||||
#import "app_delegate.h"
|
#import "app_delegate.h"
|
||||||
#import "../events/events.h"
|
#import "../events/events.h"
|
||||||
|
|
||||||
extern bool hasListeners(unsigned int);
|
extern bool hasListeners(unsigned int);
|
||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the applicationShouldTerminateAfterLastWindowClosed: method
|
// Create the applicationShouldTerminateAfterLastWindowClosed: method
|
||||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
|
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
|
||||||
{
|
{
|
||||||
return self.shouldTerminateWhenLastWindowClosed;
|
return self.shouldTerminateWhenLastWindowClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GENERATED EVENTS START
|
// GENERATED EVENTS START
|
||||||
- (void)applicationDidBecomeActive:(NSNotification *)notification {
|
- (void)applicationDidBecomeActive:(NSNotification *)notification {
|
||||||
if( hasListeners(EventApplicationDidBecomeActive) ) {
|
if( hasListeners(EventApplicationDidBecomeActive) ) {
|
||||||
|
@ -9,10 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/logger"
|
"github.com/wailsapp/wails/v3/pkg/logger"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/events"
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/assetserver/webview"
|
"github.com/wailsapp/wails/v2/pkg/assetserver/webview"
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/events"
|
||||||
)
|
)
|
||||||
|
|
||||||
var globalApplication *App
|
var globalApplication *App
|
||||||
@ -21,7 +19,7 @@ func init() {
|
|||||||
runtime.LockOSThread()
|
runtime.LockOSThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(appOptions options.Application) *App {
|
func New(appOptions Options) *App {
|
||||||
if globalApplication != nil {
|
if globalApplication != nil {
|
||||||
return globalApplication
|
return globalApplication
|
||||||
}
|
}
|
||||||
@ -44,7 +42,7 @@ func New(appOptions options.Application) *App {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func mergeApplicationDefaults(o *options.Application) {
|
func mergeApplicationDefaults(o *Options) {
|
||||||
if o.Name == "" {
|
if o.Name == "" {
|
||||||
o.Name = "My Wails Application"
|
o.Name = "My Wails Application"
|
||||||
}
|
}
|
||||||
@ -79,6 +77,13 @@ type windowMessage struct {
|
|||||||
|
|
||||||
var windowMessageBuffer = make(chan *windowMessage)
|
var windowMessageBuffer = make(chan *windowMessage)
|
||||||
|
|
||||||
|
type dragAndDropMessage struct {
|
||||||
|
windowId uint
|
||||||
|
filenames []string
|
||||||
|
}
|
||||||
|
|
||||||
|
var windowDragAndDropBuffer = make(chan *dragAndDropMessage)
|
||||||
|
|
||||||
type webViewAssetRequest struct {
|
type webViewAssetRequest struct {
|
||||||
windowId uint
|
windowId uint
|
||||||
request webview.Request
|
request webview.Request
|
||||||
@ -87,7 +92,7 @@ type webViewAssetRequest struct {
|
|||||||
var webviewRequests = make(chan *webViewAssetRequest)
|
var webviewRequests = make(chan *webViewAssetRequest)
|
||||||
|
|
||||||
type App struct {
|
type App struct {
|
||||||
options options.Application
|
options Options
|
||||||
applicationEventListeners map[uint][]func()
|
applicationEventListeners map[uint][]func()
|
||||||
applicationEventListenersLock sync.RWMutex
|
applicationEventListenersLock sync.RWMutex
|
||||||
|
|
||||||
@ -179,10 +184,10 @@ func (a *App) error(message string, args ...any) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) NewWebviewWindowWithOptions(windowOptions *options.WebviewWindow) *WebviewWindow {
|
func (a *App) NewWebviewWindowWithOptions(windowOptions *WebviewWindowOptions) *WebviewWindow {
|
||||||
// Ensure we have sane defaults
|
// Ensure we have sane defaults
|
||||||
if windowOptions == nil {
|
if windowOptions == nil {
|
||||||
windowOptions = options.WindowDefaults
|
windowOptions = WebviewWindowDefaults
|
||||||
}
|
}
|
||||||
|
|
||||||
newWindow := NewWindow(windowOptions)
|
newWindow := NewWindow(windowOptions)
|
||||||
@ -247,6 +252,12 @@ func (a *App) Run() error {
|
|||||||
a.handleWindowMessage(event)
|
a.handleWindowMessage(event)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
dragAndDropMessage := <-windowDragAndDropBuffer
|
||||||
|
a.handleDragAndDropMessage(dragAndDropMessage)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
@ -286,6 +297,19 @@ func (a *App) handleApplicationEvent(event uint) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) handleDragAndDropMessage(event *dragAndDropMessage) {
|
||||||
|
// Get window from window map
|
||||||
|
a.windowsLock.Lock()
|
||||||
|
window, ok := a.windows[event.windowId]
|
||||||
|
a.windowsLock.Unlock()
|
||||||
|
if !ok {
|
||||||
|
log.Printf("WebviewWindow #%d not found", event.windowId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Get callback from window
|
||||||
|
window.handleDragAndDropMessage(event)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) handleWindowMessage(event *windowMessage) {
|
func (a *App) handleWindowMessage(event *windowMessage) {
|
||||||
// Get window from window map
|
// Get window from window map
|
||||||
a.windowsLock.Lock()
|
a.windowsLock.Lock()
|
||||||
|
@ -230,6 +230,20 @@ func processURLRequest(windowID C.uint, wkUrlSchemeTask unsafe.Pointer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//export processDragItems
|
||||||
|
func processDragItems(windowID C.uint, arr **C.char, length C.int) {
|
||||||
|
var filenames []string
|
||||||
|
// Convert the C array to a Go slice
|
||||||
|
goSlice := (*[1 << 30]*C.char)(unsafe.Pointer(arr))[:length:length]
|
||||||
|
for _, str := range goSlice {
|
||||||
|
filenames = append(filenames, C.GoString(str))
|
||||||
|
}
|
||||||
|
windowDragAndDropBuffer <- &dragAndDropMessage{
|
||||||
|
windowId: uint(windowID),
|
||||||
|
filenames: filenames,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//export processMenuItemClick
|
//export processMenuItemClick
|
||||||
func processMenuItemClick(menuID C.uint) {
|
func processMenuItemClick(menuID C.uint) {
|
||||||
menuItemClicked <- uint(menuID)
|
menuItemClicked <- uint(menuID)
|
||||||
|
@ -67,6 +67,8 @@ func (m *MessageProcessor) HandleRuntimeCall(rw http.ResponseWriter, r *http.Req
|
|||||||
m.processApplicationMethod(method, rw, r, targetWindow, params)
|
m.processApplicationMethod(method, rw, r, targetWindow, params)
|
||||||
case "log":
|
case "log":
|
||||||
m.processLogMethod(method, rw, r, targetWindow, params)
|
m.processLogMethod(method, rw, r, targetWindow, params)
|
||||||
|
case "contextmenu":
|
||||||
|
m.processContextMenuMethod(method, rw, r, targetWindow, params)
|
||||||
default:
|
default:
|
||||||
m.httpError(rw, "Unknown runtime call: %s", object)
|
m.httpError(rw, "Unknown runtime call: %s", object)
|
||||||
}
|
}
|
||||||
|
30
v3/pkg/application/messageprocessor_contextmenu.go
Normal file
30
v3/pkg/application/messageprocessor_contextmenu.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package application
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ContextMenuData struct {
|
||||||
|
Id string `json:"id"`
|
||||||
|
X int `json:"x"`
|
||||||
|
Y int `json:"y"`
|
||||||
|
Data any `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MessageProcessor) processContextMenuMethod(method string, rw http.ResponseWriter, _ *http.Request, window *WebviewWindow, params QueryParams) {
|
||||||
|
|
||||||
|
switch method {
|
||||||
|
case "OpenContextMenu":
|
||||||
|
var data ContextMenuData
|
||||||
|
err := params.ToStruct(&data)
|
||||||
|
if err != nil {
|
||||||
|
m.httpError(rw, "error parsing contextmenu message: %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.openContextMenu(data)
|
||||||
|
m.ok(rw)
|
||||||
|
default:
|
||||||
|
m.httpError(rw, "Unknown clipboard method: %s", method)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,13 +1,15 @@
|
|||||||
package options
|
package application
|
||||||
|
|
||||||
import "github.com/wailsapp/wails/v3/pkg/logger"
|
import (
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/logger"
|
||||||
|
)
|
||||||
|
|
||||||
type Application struct {
|
type Options struct {
|
||||||
Name string
|
Name string
|
||||||
Description string
|
Description string
|
||||||
Icon []byte
|
Icon []byte
|
||||||
Mac Mac
|
Mac MacOptions
|
||||||
Bind []interface{}
|
Bind []any
|
||||||
Logger struct {
|
Logger struct {
|
||||||
Silent bool
|
Silent bool
|
||||||
CustomLoggers []logger.Output
|
CustomLoggers []logger.Output
|
@ -1,4 +1,4 @@
|
|||||||
package options
|
package application
|
||||||
|
|
||||||
type ActivationPolicy int
|
type ActivationPolicy int
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ const (
|
|||||||
ActivationPolicyProhibited
|
ActivationPolicyProhibited
|
||||||
)
|
)
|
||||||
|
|
||||||
type Mac struct {
|
type MacOptions struct {
|
||||||
// ActivationPolicy is the activation policy for the application. Defaults to
|
// ActivationPolicy is the activation policy for the application. Defaults to
|
||||||
// applicationActivationPolicyRegular.
|
// applicationActivationPolicyRegular.
|
||||||
ActivationPolicy ActivationPolicy
|
ActivationPolicy ActivationPolicy
|
||||||
@ -44,13 +44,13 @@ const (
|
|||||||
// MacWindow contains macOS specific options
|
// MacWindow contains macOS specific options
|
||||||
type MacWindow struct {
|
type MacWindow struct {
|
||||||
Backdrop MacBackdrop
|
Backdrop MacBackdrop
|
||||||
TitleBar TitleBar
|
TitleBar MacTitleBar
|
||||||
Appearance MacAppearanceType
|
Appearance MacAppearanceType
|
||||||
InvisibleTitleBarHeight int
|
InvisibleTitleBarHeight int
|
||||||
}
|
}
|
||||||
|
|
||||||
// TitleBar contains options for the Mac titlebar
|
// MacTitleBar contains options for the Mac titlebar
|
||||||
type TitleBar struct {
|
type MacTitleBar struct {
|
||||||
AppearsTransparent bool
|
AppearsTransparent bool
|
||||||
Hide bool
|
Hide bool
|
||||||
HideTitle bool
|
HideTitle bool
|
||||||
@ -60,8 +60,8 @@ type TitleBar struct {
|
|||||||
ToolbarStyle MacToolbarStyle
|
ToolbarStyle MacToolbarStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
// TitleBarDefault results in the default Mac TitleBar
|
// MacTitleBarDefault results in the default Mac MacTitleBar
|
||||||
var TitleBarDefault = TitleBar{
|
var MacTitleBarDefault = MacTitleBar{
|
||||||
AppearsTransparent: false,
|
AppearsTransparent: false,
|
||||||
Hide: false,
|
Hide: false,
|
||||||
HideTitle: false,
|
HideTitle: false,
|
||||||
@ -72,10 +72,10 @@ var TitleBarDefault = TitleBar{
|
|||||||
|
|
||||||
// Credit: Comments from Electron site
|
// Credit: Comments from Electron site
|
||||||
|
|
||||||
// TitleBarHidden results in a hidden title bar and a full size content window,
|
// MacTitleBarHidden results in a hidden title bar and a full size content window,
|
||||||
// yet the title bar still has the standard window controls (“traffic lights”)
|
// yet the title bar still has the standard window controls (“traffic lights”)
|
||||||
// in the top left.
|
// in the top left.
|
||||||
var TitleBarHidden = TitleBar{
|
var MacTitleBarHidden = MacTitleBar{
|
||||||
AppearsTransparent: true,
|
AppearsTransparent: true,
|
||||||
Hide: false,
|
Hide: false,
|
||||||
HideTitle: true,
|
HideTitle: true,
|
||||||
@ -84,9 +84,9 @@ var TitleBarHidden = TitleBar{
|
|||||||
HideToolbarSeparator: false,
|
HideToolbarSeparator: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TitleBarHiddenInset results in a hidden title bar with an alternative look where
|
// MacTitleBarHiddenInset results in a hidden title bar with an alternative look where
|
||||||
// the traffic light buttons are slightly more inset from the window edge.
|
// the traffic light buttons are slightly more inset from the window edge.
|
||||||
var TitleBarHiddenInset = TitleBar{
|
var MacTitleBarHiddenInset = MacTitleBar{
|
||||||
AppearsTransparent: true,
|
AppearsTransparent: true,
|
||||||
Hide: false,
|
Hide: false,
|
||||||
HideTitle: true,
|
HideTitle: true,
|
||||||
@ -95,9 +95,9 @@ var TitleBarHiddenInset = TitleBar{
|
|||||||
HideToolbarSeparator: true,
|
HideToolbarSeparator: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TitleBarHiddenInsetUnified results in a hidden title bar with an alternative look where
|
// MacTitleBarHiddenInsetUnified results in a hidden title bar with an alternative look where
|
||||||
// the traffic light buttons are even more inset from the window edge.
|
// the traffic light buttons are even more inset from the window edge.
|
||||||
var TitleBarHiddenInsetUnified = TitleBar{
|
var MacTitleBarHiddenInsetUnified = MacTitleBar{
|
||||||
AppearsTransparent: true,
|
AppearsTransparent: true,
|
||||||
Hide: false,
|
Hide: false,
|
||||||
HideTitle: true,
|
HideTitle: true,
|
@ -1,4 +1,4 @@
|
|||||||
package options
|
package application
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@ -14,7 +14,7 @@ const (
|
|||||||
WindowStateFullscreen
|
WindowStateFullscreen
|
||||||
)
|
)
|
||||||
|
|
||||||
type WebviewWindow struct {
|
type WebviewWindowOptions struct {
|
||||||
Name string
|
Name string
|
||||||
Title string
|
Title string
|
||||||
Width, Height int
|
Width, Height int
|
||||||
@ -29,7 +29,7 @@ type WebviewWindow struct {
|
|||||||
StartState WindowState
|
StartState WindowState
|
||||||
Mac MacWindow
|
Mac MacWindow
|
||||||
BackgroundColour *RGBA
|
BackgroundColour *RGBA
|
||||||
Assets Assets
|
Assets AssetOptions
|
||||||
HTML string
|
HTML string
|
||||||
JS string
|
JS string
|
||||||
CSS string
|
CSS string
|
||||||
@ -41,14 +41,14 @@ type WebviewWindow struct {
|
|||||||
Zoom float64
|
Zoom float64
|
||||||
}
|
}
|
||||||
|
|
||||||
var WindowDefaults = &WebviewWindow{
|
var WebviewWindowDefaults = &WebviewWindowOptions{
|
||||||
Title: "",
|
Title: "",
|
||||||
Width: 800,
|
Width: 800,
|
||||||
Height: 600,
|
Height: 600,
|
||||||
URL: "",
|
URL: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
type Assets struct {
|
type AssetOptions struct {
|
||||||
// FS to use for loading assets from
|
// FS to use for loading assets from
|
||||||
FS fs.FS
|
FS fs.FS
|
||||||
// Handler is a custom handler to use for serving assets. If this is set, the `URL` and `FS` fields are ignored.
|
// Handler is a custom handler to use for serving assets. If this is set, the `URL` and `FS` fields are ignored.
|
7
v3/pkg/application/webview_drag.h
Normal file
7
v3/pkg/application/webview_drag.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//go:build darwin
|
||||||
|
|
||||||
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
@interface WebviewDrag : NSView <NSDraggingDestination>
|
||||||
|
@property unsigned int windowId;
|
||||||
|
@end
|
60
v3/pkg/application/webview_drag.m
Normal file
60
v3/pkg/application/webview_drag.m
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
//go:build darwin
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <AppKit/AppKit.h>
|
||||||
|
#import "webview_drag.h"
|
||||||
|
|
||||||
|
#import "../events/events.h"
|
||||||
|
|
||||||
|
extern void processDragItems(unsigned int windowId, char** arr, int length);
|
||||||
|
|
||||||
|
@implementation WebviewDrag
|
||||||
|
|
||||||
|
- (instancetype)initWithFrame:(NSRect)frameRect {
|
||||||
|
self = [super initWithFrame:frameRect];
|
||||||
|
if (self) {
|
||||||
|
[self registerForDraggedTypes:@[NSFilenamesPboardType]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
|
||||||
|
NSPasteboard *pasteboard = [sender draggingPasteboard];
|
||||||
|
if ([[pasteboard types] containsObject:NSFilenamesPboardType]) {
|
||||||
|
processWindowEvent(self.windowId, EventWebViewDraggingEntered);
|
||||||
|
return NSDragOperationCopy;
|
||||||
|
}
|
||||||
|
return NSDragOperationNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (NSDragOperation)draggingExited:(id<NSDraggingInfo>)sender {
|
||||||
|
NSLog(@"I am here!!!!");
|
||||||
|
return NSDragOperationCopy;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)sender {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
|
||||||
|
NSPasteboard *pasteboard = [sender draggingPasteboard];
|
||||||
|
if ([[pasteboard types] containsObject:NSFilenamesPboardType]) {
|
||||||
|
NSArray *files = [pasteboard propertyListForType:NSFilenamesPboardType];
|
||||||
|
NSUInteger count = [files count];
|
||||||
|
char** cArray = (char**)malloc(count * sizeof(char*));
|
||||||
|
for (NSUInteger i = 0; i < count; i++) {
|
||||||
|
NSString* str = files[i];
|
||||||
|
cArray[i] = (char*)[str UTF8String];
|
||||||
|
}
|
||||||
|
processDragItems(self.windowId, cArray, (int)count);
|
||||||
|
free(cArray);
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -12,7 +12,6 @@ import (
|
|||||||
assetserveroptions "github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
assetserveroptions "github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||||
"github.com/wailsapp/wails/v3/internal/runtime"
|
"github.com/wailsapp/wails/v3/internal/runtime"
|
||||||
"github.com/wailsapp/wails/v3/pkg/events"
|
"github.com/wailsapp/wails/v3/pkg/events"
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -26,7 +25,7 @@ type (
|
|||||||
setMaxSize(width, height int)
|
setMaxSize(width, height int)
|
||||||
execJS(js string)
|
execJS(js string)
|
||||||
restore()
|
restore()
|
||||||
setBackgroundColour(color *options.RGBA)
|
setBackgroundColour(color *RGBA)
|
||||||
run()
|
run()
|
||||||
center()
|
center()
|
||||||
size() (int, int)
|
size() (int, int)
|
||||||
@ -67,7 +66,7 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type WebviewWindow struct {
|
type WebviewWindow struct {
|
||||||
options *options.WebviewWindow
|
options *WebviewWindowOptions
|
||||||
impl webviewWindowImpl
|
impl webviewWindowImpl
|
||||||
implLock sync.RWMutex
|
implLock sync.RWMutex
|
||||||
id uint
|
id uint
|
||||||
@ -89,7 +88,7 @@ func getWindowID() uint {
|
|||||||
return windowID
|
return windowID
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWindow(options *options.WebviewWindow) *WebviewWindow {
|
func NewWindow(options *WebviewWindowOptions) *WebviewWindow {
|
||||||
if options.Width == 0 {
|
if options.Width == 0 {
|
||||||
options.Width = 800
|
options.Width = 800
|
||||||
}
|
}
|
||||||
@ -313,7 +312,7 @@ func (w *WebviewWindow) ExecJS(js string) {
|
|||||||
|
|
||||||
func (w *WebviewWindow) Fullscreen() *WebviewWindow {
|
func (w *WebviewWindow) Fullscreen() *WebviewWindow {
|
||||||
if w.impl == nil {
|
if w.impl == nil {
|
||||||
w.options.StartState = options.WindowStateFullscreen
|
w.options.StartState = WindowStateFullscreen
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
if !w.IsFullscreen() {
|
if !w.IsFullscreen() {
|
||||||
@ -365,7 +364,7 @@ func (w *WebviewWindow) IsFullscreen() bool {
|
|||||||
return w.impl.isFullscreen()
|
return w.impl.isFullscreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *WebviewWindow) SetBackgroundColour(colour *options.RGBA) *WebviewWindow {
|
func (w *WebviewWindow) SetBackgroundColour(colour *RGBA) *WebviewWindow {
|
||||||
w.options.BackgroundColour = colour
|
w.options.BackgroundColour = colour
|
||||||
if w.impl != nil {
|
if w.impl != nil {
|
||||||
w.impl.setBackgroundColour(colour)
|
w.impl.setBackgroundColour(colour)
|
||||||
@ -538,7 +537,7 @@ func (w *WebviewWindow) SetPosition(x, y int) *WebviewWindow {
|
|||||||
|
|
||||||
func (w *WebviewWindow) Minimise() *WebviewWindow {
|
func (w *WebviewWindow) Minimise() *WebviewWindow {
|
||||||
if w.impl == nil {
|
if w.impl == nil {
|
||||||
w.options.StartState = options.WindowStateMinimised
|
w.options.StartState = WindowStateMinimised
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
if !w.IsMinimised() {
|
if !w.IsMinimised() {
|
||||||
@ -549,7 +548,7 @@ func (w *WebviewWindow) Minimise() *WebviewWindow {
|
|||||||
|
|
||||||
func (w *WebviewWindow) Maximise() *WebviewWindow {
|
func (w *WebviewWindow) Maximise() *WebviewWindow {
|
||||||
if w.impl == nil {
|
if w.impl == nil {
|
||||||
w.options.StartState = options.WindowStateMaximised
|
w.options.StartState = WindowStateMaximised
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
if !w.IsMaximised() {
|
if !w.IsMaximised() {
|
||||||
@ -641,3 +640,15 @@ func (w *WebviewWindow) info(message string, args ...any) {
|
|||||||
Time: time.Now(),
|
Time: time.Now(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *WebviewWindow) handleDragAndDropMessage(event *dragAndDropMessage) {
|
||||||
|
println("Drag and drop message received for " + w.Name())
|
||||||
|
// Print filenames
|
||||||
|
for _, file := range event.filenames {
|
||||||
|
println(file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WebviewWindow) openContextMenu(data ContextMenuData) {
|
||||||
|
fmt.Printf("Opening context menu for %+v\n", data)
|
||||||
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface WebviewWindowDelegate : NSObject <NSWindowDelegate, WKScriptMessageHandler, WKNavigationDelegate, WKURLSchemeHandler>
|
@interface WebviewWindowDelegate : NSObject <NSWindowDelegate, WKScriptMessageHandler, WKNavigationDelegate, WKURLSchemeHandler, NSDraggingDestination>
|
||||||
|
|
||||||
@property bool hideOnClose;
|
@property bool hideOnClose;
|
||||||
@property (retain) WKWebView* webView;
|
@property (retain) WKWebView* webView;
|
||||||
@ -29,7 +29,6 @@
|
|||||||
- (void)handleLeftMouseUp:(NSWindow *)window;
|
- (void)handleLeftMouseUp:(NSWindow *)window;
|
||||||
- (void)handleLeftMouseDown:(NSEvent*)event;
|
- (void)handleLeftMouseDown:(NSEvent*)event;
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
//go:build darwin
|
//go:build darwin
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "webview_window.h"
|
#import "webview_window.h"
|
||||||
#import "../events/events.h"
|
#import "../events/events.h"
|
||||||
|
|
||||||
extern void processMessage(unsigned int, const char*);
|
extern void processMessage(unsigned int, const char*);
|
||||||
extern void processURLRequest(unsigned int, void *);
|
extern void processURLRequest(unsigned int, void *);
|
||||||
extern bool hasListeners(unsigned int);
|
extern bool hasListeners(unsigned int);
|
||||||
|
|
||||||
@implementation WebviewWindow
|
@implementation WebviewWindow
|
||||||
|
|
||||||
- (WebviewWindow*) initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation;
|
- (WebviewWindow*) initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation;
|
||||||
{
|
{
|
||||||
self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
|
self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
|
||||||
@ -20,11 +16,9 @@ extern bool hasListeners(unsigned int);
|
|||||||
[self setMovableByWindowBackground:YES];
|
[self setMovableByWindowBackground:YES];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)canBecomeKeyWindow {
|
- (BOOL)canBecomeKeyWindow {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) canBecomeMainWindow {
|
- (BOOL) canBecomeMainWindow {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@ -38,9 +32,7 @@ extern bool hasListeners(unsigned int);
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation WebviewWindowDelegate
|
@implementation WebviewWindowDelegate
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(NSWindow *)sender {
|
- (BOOL)windowShouldClose:(NSWindow *)sender {
|
||||||
if( self.hideOnClose ) {
|
if( self.hideOnClose ) {
|
||||||
[NSApp hide:nil];
|
[NSApp hide:nil];
|
||||||
@ -48,7 +40,6 @@ extern bool hasListeners(unsigned int);
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle script messages from the external bridge
|
// Handle script messages from the external bridge
|
||||||
- (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message {
|
- (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message {
|
||||||
NSString *m = message.body;
|
NSString *m = message.body;
|
||||||
@ -83,11 +74,9 @@ extern bool hasListeners(unsigned int);
|
|||||||
- (void)handleLeftMouseUp:(NSWindow *)window {
|
- (void)handleLeftMouseUp:(NSWindow *)window {
|
||||||
self.leftMouseEvent = nil;
|
self.leftMouseEvent = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)webView:(nonnull WKWebView *)webView startURLSchemeTask:(nonnull id<WKURLSchemeTask>)urlSchemeTask {
|
- (void)webView:(nonnull WKWebView *)webView startURLSchemeTask:(nonnull id<WKURLSchemeTask>)urlSchemeTask {
|
||||||
processURLRequest(self.windowId, urlSchemeTask);
|
processURLRequest(self.windowId, urlSchemeTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)webView:(nonnull WKWebView *)webView stopURLSchemeTask:(nonnull id<WKURLSchemeTask>)urlSchemeTask {
|
- (void)webView:(nonnull WKWebView *)webView stopURLSchemeTask:(nonnull id<WKURLSchemeTask>)urlSchemeTask {
|
||||||
NSInputStream *stream = urlSchemeTask.request.HTTPBodyStream;
|
NSInputStream *stream = urlSchemeTask.request.HTTPBodyStream;
|
||||||
if (stream) {
|
if (stream) {
|
||||||
@ -97,7 +86,6 @@ extern bool hasListeners(unsigned int);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GENERATED EVENTS START
|
// GENERATED EVENTS START
|
||||||
- (void)windowDidBecomeKey:(NSNotification *)notification {
|
- (void)windowDidBecomeKey:(NSNotification *)notification {
|
||||||
if( hasListeners(EventWindowDidBecomeKey) ) {
|
if( hasListeners(EventWindowDidBecomeKey) ) {
|
||||||
@ -561,5 +549,17 @@ extern bool hasListeners(unsigned int);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WKWebView *)webview draggingEntered:(WKNavigation *)navigation {
|
||||||
|
if( hasListeners(EventWebViewDraggingEntered) ) {
|
||||||
|
processWindowEvent(self.windowId, EventWebViewDraggingEntered);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WKWebView *)webview draggingPerformed:(WKNavigation *)navigation {
|
||||||
|
if( hasListeners(EventWebViewDraggingPerformed) ) {
|
||||||
|
processWindowEvent(self.windowId, EventWebViewDraggingPerformed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// GENERATED EVENTS END
|
// GENERATED EVENTS END
|
||||||
@end
|
@end
|
||||||
|
@ -12,6 +12,8 @@ package application
|
|||||||
#include "Cocoa/Cocoa.h"
|
#include "Cocoa/Cocoa.h"
|
||||||
#import <WebKit/WebKit.h>
|
#import <WebKit/WebKit.h>
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
#import "webview_drag.h"
|
||||||
|
|
||||||
|
|
||||||
extern void registerListener(unsigned int event);
|
extern void registerListener(unsigned int event);
|
||||||
|
|
||||||
@ -69,6 +71,12 @@ void* windowNew(unsigned int id, int width, int height, bool fraudulentWebsiteWa
|
|||||||
|
|
||||||
delegate.webView = webView;
|
delegate.webView = webView;
|
||||||
delegate.hideOnClose = false;
|
delegate.hideOnClose = false;
|
||||||
|
|
||||||
|
WebviewDrag* dragView = [[WebviewDrag alloc] initWithFrame:NSMakeRect(0, 0, width-1, height-1)];
|
||||||
|
[view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
[view addSubview:dragView];
|
||||||
|
dragView.windowId = id;
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,8 +777,6 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/events"
|
"github.com/wailsapp/wails/v3/pkg/events"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/options"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var showDevTools = func(window unsafe.Pointer) {}
|
var showDevTools = func(window unsafe.Pointer) {}
|
||||||
@ -1049,10 +1055,10 @@ func (w *macosWebviewWindow) run() {
|
|||||||
|
|
||||||
macOptions := w.parent.options.Mac
|
macOptions := w.parent.options.Mac
|
||||||
switch macOptions.Backdrop {
|
switch macOptions.Backdrop {
|
||||||
case options.MacBackdropTransparent:
|
case MacBackdropTransparent:
|
||||||
C.windowSetTransparent(w.nsWindow)
|
C.windowSetTransparent(w.nsWindow)
|
||||||
C.webviewSetTransparent(w.nsWindow)
|
C.webviewSetTransparent(w.nsWindow)
|
||||||
case options.MacBackdropTranslucent:
|
case MacBackdropTranslucent:
|
||||||
C.windowSetTranslucent(w.nsWindow)
|
C.windowSetTranslucent(w.nsWindow)
|
||||||
C.webviewSetTransparent(w.nsWindow)
|
C.webviewSetTransparent(w.nsWindow)
|
||||||
}
|
}
|
||||||
@ -1077,11 +1083,11 @@ func (w *macosWebviewWindow) run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch w.parent.options.StartState {
|
switch w.parent.options.StartState {
|
||||||
case options.WindowStateMaximised:
|
case WindowStateMaximised:
|
||||||
w.maximise()
|
w.maximise()
|
||||||
case options.WindowStateMinimised:
|
case WindowStateMinimised:
|
||||||
w.minimise()
|
w.minimise()
|
||||||
case options.WindowStateFullscreen:
|
case WindowStateFullscreen:
|
||||||
w.fullscreen()
|
w.fullscreen()
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1108,7 +1114,7 @@ func (w *macosWebviewWindow) run() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *macosWebviewWindow) setBackgroundColour(colour *options.RGBA) {
|
func (w *macosWebviewWindow) setBackgroundColour(colour *RGBA) {
|
||||||
if colour == nil {
|
if colour == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,8 @@ type macEvents struct {
|
|||||||
WebViewDidReceiveServerRedirectForProvisionalNavigation WindowEventType
|
WebViewDidReceiveServerRedirectForProvisionalNavigation WindowEventType
|
||||||
WebViewDidFinishNavigation WindowEventType
|
WebViewDidFinishNavigation WindowEventType
|
||||||
WebViewDidCommitNavigation WindowEventType
|
WebViewDidCommitNavigation WindowEventType
|
||||||
|
WebViewDraggingEntered WindowEventType
|
||||||
|
WebViewDraggingPerformed WindowEventType
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMacEvents() macEvents {
|
func newMacEvents() macEvents {
|
||||||
@ -250,5 +252,7 @@ func newMacEvents() macEvents {
|
|||||||
WebViewDidReceiveServerRedirectForProvisionalNavigation: 117,
|
WebViewDidReceiveServerRedirectForProvisionalNavigation: 117,
|
||||||
WebViewDidFinishNavigation: 118,
|
WebViewDidFinishNavigation: 118,
|
||||||
WebViewDidCommitNavigation: 119,
|
WebViewDidCommitNavigation: 119,
|
||||||
|
WebViewDraggingEntered: 120,
|
||||||
|
WebViewDraggingPerformed: 121,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,10 @@ extern void processWindowEvent(unsigned int, unsigned int);
|
|||||||
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 117
|
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 117
|
||||||
#define EventWebViewDidFinishNavigation 118
|
#define EventWebViewDidFinishNavigation 118
|
||||||
#define EventWebViewDidCommitNavigation 119
|
#define EventWebViewDidCommitNavigation 119
|
||||||
|
#define EventWebViewDraggingEntered 120
|
||||||
|
#define EventWebViewDraggingPerformed 121
|
||||||
|
|
||||||
#define MAX_EVENTS 120
|
#define MAX_EVENTS 123
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -118,4 +118,7 @@ mac:WebViewDidStartProvisionalNavigation
|
|||||||
mac:WebViewDidReceiveServerRedirectForProvisionalNavigation
|
mac:WebViewDidReceiveServerRedirectForProvisionalNavigation
|
||||||
mac:WebViewDidFinishNavigation
|
mac:WebViewDidFinishNavigation
|
||||||
mac:WebViewDidCommitNavigation
|
mac:WebViewDidCommitNavigation
|
||||||
|
mac:WebViewDraggingEntered
|
||||||
|
mac:WebViewDraggingPerformed
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the window_delegate.m file
|
// Load the window_delegate.m file
|
||||||
windowDelegate, err := os.ReadFile("../../pkg/application/window_delegate.m")
|
windowDelegate, err := os.ReadFile("../../pkg/application/webview_window.m")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = os.WriteFile("../../pkg/application/window_delegate.m", buffer.Bytes(), 0755)
|
err = os.WriteFile("../../pkg/application/webview_window.m", buffer.Bytes(), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user