src/Form/View/Helper/FormEditor.php
public function render(ElementInterface $element)
    {
        $name   = $element->getName();
        if (empty($name) && $name !== 0) {
            throw new \DomainException(
                sprintf(
                    '%s requires that the element has an assigned name; none discovered',
                    __METHOD__
                )
            );
        }

        if ($editorOptions = $element->getOption('editor')) {
            $this->setOptions($editorOptions);
        }
        /* @var \Zend\View\Renderer\PhpRenderer $renderer */
        $renderer = $this->getView();
        /* @var \Zend\View\Helper\HeadScript  $headscript */
        $headscript = $renderer->plugin('headscript');
        /* @var \Zend\View\Helper\BasePath  $basepath */
        $basepath = $renderer->plugin('basepath');

        //$headscript->appendFile($basepath('assets/tinymce/tinymce.min.js'));
        //$headscript->prependFile($basepath('/assets/jquery/jquery.min.js'));

        $headscript->offsetSetScript(
            '1000_tinymce_' . $this->getTheme(),
            '
            $(document).ready(function() {
            tinyMCE.init({' . $this->additionalOptions() . ',
                 skin_url: "'.$this->skinUrl.'",
                 setup:  function(editor) {
                 
                    setPlaceHolder = function(editor, show) {
                        placeHolder = $("#placeholder-" + editor.id);
                        if (placeHolder.length == 1) {
                            if (show && editor.getContent() == "") {
                                placeHolder.show();
                            }
                            else {
                                placeHolder.hide();
                            }
                         }
                    },
                    editor.on("focus", function(e) {
                        setPlaceHolder(editor, false);
                    });
                    editor.on("blur", function(e) {
                        setPlaceHolder(editor, true);
                        if (editor.isDirty()) {
                            //console.log("blur event", e);
                            editor.save();
                            var container = e.target.bodyElement;
                            $(container).parents("html").addClass("yk-changed");
                            var form = $(container).parents("form");
                            //console.log("form", form, container);
                            ' . ($element->getOption('no-submit') ? '' : 'form.submit();').'
                            $(form).on("yk.forms.done", function(){
                                console.log("done");
                                //$(container).parents("html").removeClass("yk-changed");
                            });
                        }
                    });
                },
                init_instance_callback: function (instance)  { instance.save(); }
            });
            });'
        );

        $attributes         = $element->getAttributes();
        $attributes['name'] = $name;
        $attributes['id']   = $name;
        $content            = $element->getValue();
        if (!isset($content)) {
            $content = '';
        }
        if (is_string($content)) {
            $class = array_key_exists('class', $attributes)?$attributes['class']:'';
            $class .= (empty($class)?:' ') . ' tinymce_' . $this->getTheme();
            $attributes['class'] = $class;
            $placeHolder = '';
            $elementOptions = $element->getOptions();
            if (array_key_exists('placeholder', $elementOptions) && !empty($elementOptions['placeholder'])) {
                $placeHolder = '<div id="placeholder-' . $name . '" style="border: 0 none; position: relative; top: 0ex; left: 10px; color: #aaa; height: 0px; overflow: visible;' .
                               (empty($content)?'':'display:none;') .
                               '">' . $this->translator->translate($elementOptions['placeholder']) . '</div>';
            }
            return
                $placeHolder
                . sprintf(
                    '<div %s >%s</div>',
                    $this->createAttributesString($attributes),
                    $content
                );
        } else {
            return (string) $content;
        }
    }
public function render(ElementInterface $element)
    {
        $name   = $element->getName();
        if (empty($name) && $name !== 0) {
            throw new \DomainException(
                sprintf(
                    '%s requires that the element has an assigned name; none discovered',
                    __METHOD__
                )
            );
        }

        if ($editorOptions = $element->getOption('editor')) {
            $this->setOptions($editorOptions);
        }
        /* @var \Zend\View\Renderer\PhpRenderer $renderer */
        $renderer = $this->getView();
        /* @var \Zend\View\Helper\HeadScript  $headscript */
        $headscript = $renderer->plugin('headscript');
        /* @var \Zend\View\Helper\BasePath  $basepath */
        $basepath = $renderer->plugin('basepath');

        //$headscript->appendFile($basepath('assets/tinymce/tinymce.min.js'));
        //$headscript->prependFile($basepath('/assets/jquery/jquery.min.js'));

        $headscript->offsetSetScript(
            '1000_tinymce_' . $this->getTheme(),
            '
            $(document).ready(function() {
            tinyMCE.init({' . $this->additionalOptions() . ',
                 skin_url: "'.$this->skinUrl.'",
                 setup:  function(editor) {
                 
                    setPlaceHolder = function(editor, show) {
                        placeHolder = $("#placeholder-" + editor.id);
                        if (placeHolder.length == 1) {
                            if (show && editor.getContent() == "") {
                                placeHolder.show();
                            }
                            else {
                                placeHolder.hide();
                            }
                         }
                    },
                    editor.on("focus", function(e) {
                        setPlaceHolder(editor, false);
                    });
                    editor.on("blur", function(e) {
                        setPlaceHolder(editor, true);
                        if (editor.isDirty()) {
                            //console.log("blur event", e);
                            editor.save();
                            var container = e.target.bodyElement;
                            $(container).parents("html").addClass("yk-changed");
                            var form = $(container).parents("form");
                            //console.log("form", form, container);
                            ' . ($element->getOption('no-submit') ? '' : 'form.submit();').'
                            $(form).on("yk.forms.done", function(){
                                console.log("done");
                                //$(container).parents("html").removeClass("yk-changed");
                            });
                        }
                    });
                },
                init_instance_callback: function (instance)  { instance.save(); }
            });
            });'
        );

        $attributes         = $element->getAttributes();
        $attributes['name'] = $name;
        $attributes['id']   = $name;
        $content            = $element->getValue();
        if (!isset($content)) {
            $content = '';
        }
        if (is_string($content)) {
            $class = array_key_exists('class', $attributes)?$attributes['class']:'';
            $class .= (empty($class)?:' ') . ' tinymce_' . $this->getTheme();
            $attributes['class'] = $class;
            $placeHolder = '';
            $elementOptions = $element->getOptions();
            if (array_key_exists('placeholder', $elementOptions) && !empty($elementOptions['placeholder'])) {
                $placeHolder = '<div id="placeholder-' . $name . '" style="border: 0 none; position: relative; top: 0ex; left: 10px; color: #aaa; height: 0px; overflow: visible;' .
                               (empty($content)?'':'display:none;') .
                               '">' . $this->translator->translate($elementOptions['placeholder']) . '</div>';
            }
            return
                $placeHolder
                . sprintf(
                    '<div %s >%s</div>',
                    $this->createAttributesString($attributes),
                    $content
                );
        } else {
            return (string) $content;
        }
    }
@param ElementInterface $element

@return string