Getting Started

Installation

Give the application access to the package in the PHP Packages application, then install it with Composer:

scripts/composer.sh require alberon/nexus-wysiwyg

The package will automatically create a symlink public/vendor/nexus-wyswiyg, which points to the package assets in vendor/nexus-wysiwyg/public/.

Usage

To use the WYSIWYG editor in a Vue component:

<script>
    import FieldWysiwygStandard from '@alberon/nexus-wysiwyg/vue/FieldWysiwygStandard';

    export default {
        components: {
            //...
            FieldWysiwygStandard,
            //...
        },
    }
</script>

<template>
    ...
    <FieldWysiwygStandard
        v-model="form.content_html"
    />
    ...
</template>

See Variations & Customisation for more details.

It is recommended to end the field name with _html to make it obvious what it contains during code reviews and maintenance.

Outputting HTML

Security Warning:

You should always use the sanitise_html() function (which uses the Purifier library) before outputting the HTML, to prevent users injecting JavaScript or invalid HTML. For example:

{{ sanitise_html($example->content_html) }}

See Outputting HTML for more details.