Commit 5bd19506 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Fixing le problème des plus customs

parent 14cdbe26
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ $array = "[" . implode(",", $temp) . "]";
    }

    function initTinymce() {
        tinymce.remove();
        // tinymce.remove();
        tinymce.init({
            selector: '.tinymce',
            toolbar: 'newdocument undo redo | bold italic underline removeformat | bullist',
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ $options = ($champ->getOptions() !== null)??explode(';', $champ->getOptions());
            <?php endif; ?>
            <div class="col-sm-12">
                <textarea
                        class="form-control autoform-textarea"
                        class="form-control autoform-textarea tinymce"
                        id="textarea_<?php echo $champ->getId(); ?>" name="<?php echo $champ->getId(); ?>"
                        <?php if ($champ->isObligatoire()) : ?> required <?php endif; ?>
                ><?php echo $reponse?trim($reponse):""; ?></textarea>
+14 −2
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ $qbottom = !((isset($options['raccourci-bottom']) and $options['raccourci-bottom
            valid_classes: {
                'p' : {},
            },
            selector: '.autoform-textarea',
            selector: '.tinymce',
            plugins: 'lists',
            toolbar: 'newdocument undo redo removeformat | bold italic | bullist numlist ',
            resize: true,
@@ -250,16 +250,28 @@ $qbottom = !((isset($options['raccourci-bottom']) and $options['raccourci-bottom
            menubar: false,
            body_id: 'textarea_<?php echo $champ?->getId(); ?>',
            setup: function (editor) {
                editor.on("focusout", function () {
                editor
                    .on("focusout", function () {
                    let id = $(this).attr('id');
                    // console.log(id);
                    $('#'+id).text(tinymce.get(id).getContent());
                    // console.log(tinymce.get(id).getContent());
                    // console.log($('#'+id).text());
                    checkForEmpty();
                })
                    .on("change", function (e) {
                        var event = new CustomEvent("change-via-tinmce", { "detail": "Example of an event" });
                        document.dispatchEvent(event);
                    });
                ;
            },
            onchange: function (editor) {
                alert('change tinymce');
            }
        });
        tinymce.activeEditor.on('click', (e) => {
            console.log('Editor was clicked at: ' + e.pageX + ', ' + e.pageY);
        });
    });