How to use the medium-editor/dist/js/medium-editor.js function in medium-editor

To help you get started, we’ve selected a few medium-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / timesketch / timesketch / ui / story / story.directive.ts View on Github external
timesketchApi.getStory(scope.sketchId, scope.storyId).success(function (data) {
                const story = data.objects[0];
                const meta = data.meta;
                story.updated_at = moment.utc(story.updated_at).format('YYYY-MM-DD HH:MM');
                scope.story = story;
                scope.isEditable = meta['is_editable'];

                // Setup the medium editors
                scope.titleEditor = new MediumEditor('.editable-title', {
                    placeholder: {
                        text: 'Title',
                        hideOnClick: false,
                    },
                    disableReturn: true,
                    toolbar: false,
                    disableEditing: !scope.isEditable,
                });

                scope.contentEditor = new MediumEditor('.editable', {
                    placeholder: {
                        text: 'Your story starts here...',
                        hideOnClick: false,
                    },
                    toolbar: scope.isEditable,
                    disableEditing: !scope.isEditable,
github google / timesketch / timesketch / ui / story / story.directive.ts View on Github external
story.updated_at = moment.utc(story.updated_at).format('YYYY-MM-DD HH:MM');
                scope.story = story;
                scope.isEditable = meta['is_editable'];

                // Setup the medium editors
                scope.titleEditor = new MediumEditor('.editable-title', {
                    placeholder: {
                        text: 'Title',
                        hideOnClick: false,
                    },
                    disableReturn: true,
                    toolbar: false,
                    disableEditing: !scope.isEditable,
                });

                scope.contentEditor = new MediumEditor('.editable', {
                    placeholder: {
                        text: 'Your story starts here...',
                        hideOnClick: false,
                    },
                    toolbar: scope.isEditable,
                    disableEditing: !scope.isEditable,
                });
                set_content(story.title, story.content);

                const editableEvents = ['editableKeyup', 'editableClick'];
                for (const editableEvent of editableEvents) {
                    scope.contentEditor.subscribe(editableEvent, function (event, editable) {
                        const selection = window.getSelection();
                        const range = selection.getRangeAt(0);
                        const current = $(range.commonAncestorContainer);