Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
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);