diff --git a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/useProperty.kt b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/useProperty.kt index 4d00f15b..87312f6f 100644 --- a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/useProperty.kt +++ b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/useProperty.kt @@ -13,20 +13,20 @@ import kotlin.reflect.KProperty1 /** - * Call [callBack] on initial value of the property and then on all subsequent values after change + * Call [callback] on initial value of the property and then on all subsequent values after change */ public fun Vision.useProperty( propertyName: Name, inherit: Boolean? = null, includeStyles: Boolean? = null, scope: CoroutineScope? = manager?.context, - callBack: (Meta) -> Unit, + callback: (Meta) -> Unit, ): Job { //Pass initial value. - callBack(properties.getProperty(propertyName, inherit, includeStyles)) + callback(properties.getProperty(propertyName, inherit, includeStyles)) return properties.changes.onEach { name -> if (name.startsWith(propertyName)) { - callBack(properties.getProperty(propertyName, inherit, includeStyles)) + callback(properties.getProperty(propertyName, inherit, includeStyles)) } }.launchIn(scope ?: error("Orphan Vision can't observe properties")) } @@ -36,19 +36,19 @@ public fun Vision.useProperty( inherit: Boolean? = null, includeStyles: Boolean? = null, scope: CoroutineScope? = manager?.context, - callBack: (Meta) -> Unit, -): Job = useProperty(propertyName.parseAsName(), inherit, includeStyles, scope, callBack) + callback: (Meta) -> Unit, +): Job = useProperty(propertyName.parseAsName(), inherit, includeStyles, scope, callback) public fun V.useProperty( property: KProperty1, scope: CoroutineScope? = manager?.context, - callBack: V.(T) -> Unit, + callback: V.(T) -> Unit, ): Job { //Pass initial value. - callBack(property.get(this)) + callback(property.get(this)) return properties.changes.onEach { name -> if (name.startsWith(property.name.asName())) { - callBack(property.get(this@useProperty)) + callback(property.get(this@useProperty)) } }.launchIn(scope ?: error("Orphan Vision can't observe properties")) } \ No newline at end of file diff --git a/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt b/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt index e79908f0..aad66f3f 100644 --- a/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt +++ b/visionforge-markdown/src/jsMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt @@ -12,6 +12,7 @@ import space.kscience.dataforge.context.PluginFactory import space.kscience.dataforge.context.PluginTag import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.names.Name +import space.kscience.dataforge.names.asName import space.kscience.visionforge.* import space.kscience.visionforge.markup.VisionOfMarkup.Companion.COMMONMARK_FORMAT import space.kscience.visionforge.markup.VisionOfMarkup.Companion.GFM_FORMAT @@ -44,8 +45,13 @@ public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer { element.append(div) } + override fun content(target: String): Map = when (target) { + ElementVisionRenderer.TYPE -> mapOf("markup".asName() to this) + else -> super.content(target) + } + public actual companion object : PluginFactory { - override val tag: PluginTag = PluginTag("vision.markup", PluginTag.DATAFORGE_GROUP) + override val tag: PluginTag = PluginTag("vision.markup.js", PluginTag.DATAFORGE_GROUP) override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin() diff --git a/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt b/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt index b95c291f..ce094ee9 100644 --- a/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt +++ b/visionforge-markdown/src/jvmMain/kotlin/space/kscience/visionforge/markup/MarkupPlugin.kt @@ -14,7 +14,7 @@ public actual class MarkupPlugin : VisionPlugin() { override val tag: PluginTag get() = Companion.tag public actual companion object : PluginFactory { - override val tag: PluginTag = PluginTag("vision.markup", PluginTag.DATAFORGE_GROUP) + override val tag: PluginTag = PluginTag("vision.markup.jvm", PluginTag.DATAFORGE_GROUP) override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin()