Gunslingor
08/11/2020, 5:08 PM@JsModule("grapesjs")
external class Grapes {
fun init(lambda: () -> Unit): Grapes = definedExternally
}
class WebEditorViewController {
val grapes = Grapes().init {
val container = "#gjs"
val fromElement = true
}
}
And here is what the actual JS is supposed to look like, from the hello world examples
const editor = grapesjs.init({
container: '#gjs',
fromElement: true,
height: '300px',
width: 'auto',
storageManager: false,
panels: { defaults: [] },
});
Gunslingor
08/11/2020, 5:11 PMGunslingor
08/11/2020, 5:19 PMGunslingor
08/11/2020, 5:51 PMGunslingor
08/11/2020, 5:54 PMturansky
08/11/2020, 6:27 PMGunslingor
08/11/2020, 6:29 PMandylamax
08/11/2020, 6:47 PMexternal interface Panels {
var defaults: Array<dynamic>
}
external interface GrapesInit {
var container: String
var fromElement: Boolean
var height: String
var width: String
var storageManager: Boolean
var panels: Panels
}
@JsModule("grapesjs")
external object Grapes {
fun init(param: GrapesInit)
}
//usage
val editor = Grapes.init(jsObject{
container = "#gjs"
. . .
})
Gunslingor
08/11/2020, 6:57 PMGunslingor
08/11/2020, 7:00 PMGunslingor
08/11/2020, 7:04 PMandylamax
08/11/2020, 7:07 PMGunslingor
08/11/2020, 7:07 PMandylamax
08/11/2020, 7:08 PMandylamax
08/11/2020, 7:09 PMGunslingor
08/11/2020, 7:09 PMGunslingor
08/11/2020, 7:09 PMimplementation(kotlin("stdlib-js"))
This seems to work fine
implementation("com.beust:klaxon:5.2")
Can't access klaxon or that jsObject. strangeGunslingor
08/11/2020, 7:13 PMRobert Jaros
08/11/2020, 7:14 PMjsObject
is not in stdlib, it's in kotlin-extensions:
https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-extensionsRobert Jaros
08/11/2020, 7:15 PMRobert Jaros
08/11/2020, 7:16 PMGunslingor
08/11/2020, 7:17 PMGunslingor
08/11/2020, 7:18 PMRobert Jaros
08/11/2020, 7:20 PMRobert Jaros
08/11/2020, 7:21 PMRobert Jaros
08/11/2020, 7:22 PMGunslingor
08/11/2020, 7:24 PMRobert Jaros
08/11/2020, 7:27 PMGunslingor
08/11/2020, 7:28 PMGunslingor
08/11/2020, 7:28 PMGunslingor
08/11/2020, 7:29 PMRobert Jaros
08/11/2020, 7:29 PMdukat
but is still very immatureGunslingor
08/11/2020, 7:30 PMGunslingor
08/11/2020, 7:32 PMRobert Jaros
08/11/2020, 7:32 PMGunslingor
08/11/2020, 7:32 PMRobert Jaros
08/11/2020, 7:32 PMRobert Jaros
08/11/2020, 7:33 PMRobert Jaros
08/11/2020, 7:34 PMRobert Jaros
08/11/2020, 7:35 PMGunslingor
08/11/2020, 7:36 PMRobert Jaros
08/11/2020, 7:36 PMRobert Jaros
08/11/2020, 7:37 PMGunslingor
08/11/2020, 7:40 PMGunslingor
08/11/2020, 7:43 PMGunslingor
08/11/2020, 7:45 PMRobert Jaros
08/11/2020, 7:45 PMRobert Jaros
08/11/2020, 7:45 PMdynamic
Robert Jaros
08/11/2020, 7:46 PMGunslingor
08/11/2020, 7:49 PMRobert Jaros
08/11/2020, 7:53 PMRobert Jaros
08/11/2020, 7:54 PMdynamic
you loose what Kotlin is really about, so it could just make no senseRobert Jaros
08/11/2020, 7:56 PMRobert Jaros
08/11/2020, 8:00 PMRobert Jaros
08/11/2020, 8:01 PMGunslingor
08/11/2020, 8:53 PMGunslingor
08/11/2020, 8:55 PMandylamax
08/11/2020, 9:03 PMGunslingor
08/11/2020, 9:05 PMGunslingor
08/11/2020, 9:15 PMlink("/libs/grapesjs/css/grapes.min.css","stylesheet")
script(src = "/libs/grapesjs/js/grapes.min.js") {}
or is it included in my own MyProject.jsandylamax
08/11/2020, 9:18 PMrequire
webpack will handle the rest. So no need to include themGunslingor
08/11/2020, 9:25 PMget("demo") {
call.respondHtml {
//TODO: Ad new HTML5 footer
head {
link("/libs/metro/css/metro-all.min.css","stylesheet")
link("/libs/grapesjs/css/grapes.min.css","stylesheet")
}
body("h-100") {
div("h-100") {
id = "content"
attributes["style"] = "min-height=100%"
+loadingString()
}
script(src = "/libs/three.js/js/three.min.js") {}
script(src = "/libs/metro/js/metro.min.js") {}
script(src = "/libs/grapesjs/js/grapes.min.js") {}
script(src = "/PipelineDXP.js") {}
}
}
}
Gunslingor
08/11/2020, 9:25 PMandylamax
08/11/2020, 9:41 PMGunslingor
08/11/2020, 9:55 PMandylamax
08/11/2020, 10:00 PMGunslingor
08/11/2020, 10:02 PMGunslingor
08/12/2020, 12:42 AMval metro4 = kotlinext.js.require("metro4")
fun main() {
document.addEventListener("DOMContentLoaded", {
demoTableAndProjection()
})
}
andylamax
08/12/2020, 1:06 AMmetro4
KotlinDCE will chew it up for breakfast. Put your require inside mainGunslingor
08/12/2020, 1:08 AMfun main() {
val metro4 = kotlinext.js.require("metro4")
document.addEventListener("DOMContentLoaded", {
demoWebEditor()
})
}
How do I path to the css associated with it?Gunslingor
08/12/2020, 1:10 AMandylamax
08/12/2020, 1:14 AMkotlinext.js.require("metro4/path/to/styles.css")
But this will work if you have configured css modules for webpackGunslingor
08/12/2020, 1:21 AMlink("/libs/grapesjs/css/grapes.min.css","stylesheet")
Plus the adapter yall helped me make. So I guess perhaps it might be configured by defaultGunslingor
08/12/2020, 1:23 AM