Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-mobiledoc-editor

Package Overview
Dependencies
Maintainers
5
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-mobiledoc-editor - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

.github/dependabot.yml

308

addon/components/mobiledoc-editor/component.js

@@ -1,11 +0,15 @@

import { schedule, run, begin, end, join } from '@ember/runloop';
import { copy } from '@ember/object/internals';
/* eslint-disable ember/no-component-lifecycle-hooks */
/* eslint-disable ember/no-actions-hash */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
/* eslint-disable ember/no-classic-components */
import { schedule, begin, end, join, next } from '@ember/runloop';
import { copy } from 'ember-copy';
import { A } from '@ember/array';
import { camelize, capitalize } from '@ember/string';
import EmberObject, { computed } from '@ember/object';
import EmberObject, { action, computed } from '@ember/object';
import Component from '@ember/component';
import Ember from 'ember';
import layout from './template';
import Editor from 'mobiledoc-kit/editor/editor';
import { MOBILEDOC_VERSION } from 'mobiledoc-kit/renderers/mobiledoc';
import { Editor, MOBILEDOC_VERSION } from 'mobiledoc-kit';
import assign from 'ember-mobiledoc-editor/utils/polyfill-assign';

@@ -28,3 +32,3 @@

cards: [],
sections: []
sections: [],
};

@@ -35,10 +39,11 @@

values: ['left', 'center', 'right'],
defaultValue: 'left'
}
}
defaultValue: 'left',
},
};
function arrayToMap(array) {
let map = Object.create(null);
array.forEach(key => {
if (key) { // skip undefined/falsy key values
array.forEach((key) => {
if (key) {
// skip undefined/falsy key values
key = `is${capitalize(camelize(key))}`;

@@ -65,19 +70,32 @@ map[key] = true;

// merge in named options with the `options` property data-bag
editorOptions: computed(function() {
let options = this.get('options') || {};
editorOptions: computed(
'atoms',
'autofocus',
'cardOptions',
'cards',
'options',
'placeholder',
'showLinkTooltips',
'spellcheck',
function () {
let options = this.options || {};
return assign({
placeholder: this.get('placeholder'),
spellcheck: this.get('spellcheck'),
autofocus: this.get('autofocus'),
showLinkTooltips: this.get('showLinkTooltips'),
cardOptions: this.get('cardOptions'),
cards: this.get('cards') || [],
atoms: this.get('atoms') || []
}, options);
}),
return assign(
{
placeholder: this.placeholder,
spellcheck: this.spellcheck,
autofocus: this.autofocus,
showLinkTooltips: this.showLinkTooltips,
cardOptions: this.cardOptions,
cards: this.cards || [],
atoms: this.atoms || [],
},
options
);
}
),
init() {
this._super(...arguments);
let mobiledoc = this.get('mobiledoc');
let mobiledoc = this.mobiledoc;
if (!mobiledoc) {

@@ -87,3 +105,3 @@ mobiledoc = EMPTY_MOBILEDOC;

}
let sectionAttributesConfig = this.get('sectionAttributesConfig');
let sectionAttributesConfig = this.sectionAttributesConfig;
if (!sectionAttributesConfig) {

@@ -99,9 +117,12 @@ sectionAttributesConfig = DEFAULT_SECTION_ATTRIBUTES_CONFIG;

this.set('activeSectionAttributes', {});
this._startedRunLoop = false;
this._startedRunLoop = false;
},
@action
isDefaultAttributeValue(attributeName, attributeValue) {
let defaultValue = this.sectionAttributesConfig[attributeName].defaultValue;
if (!defaultValue) {
throw new Error(`Default value is not configured for attribute '${attributeName}'`);
throw new Error(
`Default value is not configured for attribute '${attributeName}'`
);
}

@@ -111,70 +132,74 @@ return attributeValue === defaultValue;

actions: {
toggleMarkup(markupTagName) {
let editor = this.get('editor');
editor.toggleMarkup(markupTagName);
},
@action
toggleMarkup(markupTagName) {
let editor = this.editor;
editor.toggleMarkup(markupTagName);
},
toggleSection(sectionTagName) {
let editor = this.get('editor');
editor.toggleSection(sectionTagName);
},
@action
toggleSection(sectionTagName) {
let editor = this.editor;
editor.toggleSection(sectionTagName);
},
setAttribute(attributeName, attributeValue) {
let editor = this.get('editor');
if (this.isDefaultAttributeValue(attributeName, attributeValue)) {
editor.removeAttribute(attributeName);
} else {
editor.setAttribute(attributeName, attributeValue);
}
},
@action
setAttribute(attributeName, attributeValue) {
let editor = this.editor;
if (this.isDefaultAttributeValue(attributeName, attributeValue)) {
editor.removeAttribute(attributeName);
} else {
editor.setAttribute(attributeName, attributeValue);
}
},
removeAttribute(attributeName) {
let editor = this.get('editor');
editor.setAttribute(attributeName);
},
@action
removeAttribute(attributeName) {
let editor = this.editor;
editor.setAttribute(attributeName);
},
addCard(cardName, payload={}) {
this._addCard(cardName, payload);
},
@action
addCard(cardName, payload = {}) {
this._addCard(cardName, payload);
},
addAtom(atomName, text='', payload={}) {
this._addAtom(atomName, text, payload);
},
@action
addAtom(atomName, text = '', payload = {}) {
this._addAtom(atomName, text, payload);
},
addCardInEditMode(cardName, payload={}) {
let editMode = true;
this._addCard(cardName, payload, editMode);
},
@action
addCardInEditMode(cardName, payload = {}) {
let editMode = true;
this._addCard(cardName, payload, editMode);
},
toggleLink() {
let editor = this.get('editor');
if (!editor.hasCursor()) {
return;
}
if (editor.hasActiveMarkup('a')) {
editor.toggleMarkup('a');
} else {
this.set('linkOffsets', editor.range);
}
},
@action
toggleLink() {
let editor = this.editor;
if (!editor.hasCursor()) {
return;
}
if (editor.hasActiveMarkup('a')) {
editor.toggleMarkup('a');
} else {
this.set('linkOffsets', editor.range);
}
},
completeLink(href) {
let offsets = this.get('linkOffsets');
this.set('linkOffsets', null);
let editor = this.get('editor');
editor.selectRange(offsets);
editor.toggleMarkup('a', {href});
},
@action
completeLink(href) {
let offsets = this.linkOffsets;
this.set('linkOffsets', null);
let editor = this.editor;
editor.selectRange(offsets);
editor.toggleMarkup('a', { href });
},
cancelLink() {
this.set('linkOffsets', null);
},
isDefaultAttributeValue() {
return this.isDefaultAttributeValue(...arguments);
}
@action
cancelLink() {
this.set('linkOffsets', null);
},
editingContexts: computed(function() {
editingContexts: computed(function () {
return A([]);

@@ -184,10 +209,10 @@ }),

willRender() {
this._super(...arguments);
// Use a default mobiledoc. If there are no changes, then return
// early.
let mobiledoc = this.get('mobiledoc') || EMPTY_MOBILEDOC;
let mobiledoc = this.mobiledoc || EMPTY_MOBILEDOC;
if (
(
(this._localMobiledoc && this._localMobiledoc === mobiledoc) ||
(this._upstreamMobiledoc && this._upstreamMobiledoc === mobiledoc)
) && (this._lastIsEditingDisabled === this.get('isEditingDisabled'))
((this._localMobiledoc && this._localMobiledoc === mobiledoc) ||
(this._upstreamMobiledoc && this._upstreamMobiledoc === mobiledoc)) &&
this._lastIsEditingDisabled === this.isEditingDisabled
) {

@@ -197,3 +222,3 @@ // No change to mobiledoc, no need to recreate the editor

}
this._lastIsEditingDisabled = this.get('isEditingDisabled');
this._lastIsEditingDisabled = this.isEditingDisabled;
this._upstreamMobiledoc = mobiledoc;

@@ -205,3 +230,3 @@ this._localMobiledoc = null;

// Teardown any old editor that might be around.
let editor = this.get('editor');
let editor = this.editor;
if (editor) {

@@ -212,6 +237,6 @@ editor.destroy();

// Create a new editor.
let editorOptions = this.get('editorOptions');
let editorOptions = this.editorOptions;
editorOptions.mobiledoc = mobiledoc;
let componentHooks = {
[ADD_CARD_HOOK]: ({env, options, payload}, isEditing=false) => {
[ADD_CARD_HOOK]: ({ env, options, payload }, isEditing = false) => {
let cardId = Ember.uuid();

@@ -237,10 +262,10 @@ let cardName = env.name;

editor,
postModel: env.postModel
postModel: env.postModel,
});
schedule('afterRender', () => {
this.get('componentCards').pushObject(card);
this.componentCards.pushObject(card);
});
return { card, element };
},
[ADD_ATOM_HOOK]: ({env, options, payload, value}) => {
[ADD_ATOM_HOOK]: ({ env, options, payload, value }) => {
let atomId = Ember.uuid();

@@ -263,6 +288,6 @@ let atomName = env.name;

editor,
postModel: env.postModel
postModel: env.postModel,
});
schedule('afterRender', () => {
this.get('componentAtoms').pushObject(atom);
this.componentAtoms.pushObject(atom);
});

@@ -272,10 +297,13 @@ return { atom, element };

[REMOVE_CARD_HOOK]: (card) => {
this.get('componentCards').removeObject(card);
this.componentCards.removeObject(card);
},
[REMOVE_ATOM_HOOK]: (atom) => {
this.get('componentAtoms').removeObject(atom);
}
this.componentAtoms.removeObject(atom);
},
};
if (editorOptions.cardOptions) {
editorOptions.cardOptions = assign(editorOptions.cardOptions, componentHooks);
editorOptions.cardOptions = assign(
editorOptions.cardOptions,
componentHooks
);
} else {

@@ -286,12 +314,17 @@ editorOptions.cardOptions = componentHooks;

editor.willRender(() => {
// The editor's render/rerender will happen after this `editor.willRender`,
// so we explicitly start a runloop here if there is none, so that the
// add/remove card hooks happen inside a runloop.
// The editor's rendering call will happen after this `editor.willRender`,
// so we explicitly start a runloop here, so that the add/remove card hooks
// happen inside a runloop.
// When pasting text that gets turned into a card, for example,
// the add card hook would run outside the runloop if we didn't begin a new
// the add card hook could run outside the runloop if we didn't begin a new
// one now.
if (!run.currentRunLoop) {
this._startedRunLoop = true;
begin();
}
this._startedRunLoop = true;
begin();
// If this run loop is not ended by the next runloop, explicitly end it.
next(() => {
if (this._startedRunLoop) {
this._startedRunLoop = false;
end();
}
});
});

@@ -312,3 +345,5 @@ editor.didRender(() => {

editor.inputModeDidChange(() => {
if (this.isDestroyed) { return; }
if (this.isDestroyed) {
return;
}
join(() => {

@@ -319,3 +354,5 @@ this.inputModeDidChange(editor);

editor.cursorDidChange(() => {
if (this.isDestroyed) { return; }
if (this.isDestroyed) {
return;
}
join(() => {

@@ -325,3 +362,3 @@ this.cursorDidChange(editor);

});
if (this.get('isEditingDisabled')) {
if (this.isEditingDisabled) {
editor.disableEditing();

@@ -334,10 +371,15 @@ }

didRender() {
let editor = this.get('editor');
this._super(...arguments);
let editor = this.editor;
if (!editor.hasRendered) {
let editorElement = this.element.querySelector('.mobiledoc-editor__editor');
let editorElement = this.element.querySelector(
'.mobiledoc-editor__editor'
);
this._isRenderingEditor = true;
try {
editor.render(editorElement);
} catch(e) {
run.schedule('afterRender', () => { throw e; });
} catch (e) {
schedule('afterRender', () => {
throw e;
});
}

@@ -350,3 +392,4 @@ this._isRenderingEditor = false;

willDestroyElement() {
let editor = this.get('editor');
this._super(...arguments);
let editor = this.editor;
editor.destroy();

@@ -356,3 +399,3 @@ },

postDidChange(editor) {
let serializeVersion = this.get('serializeVersion');
let serializeVersion = this.serializeVersion;
let updatedMobileDoc = editor.serialize(serializeVersion);

@@ -375,5 +418,5 @@ this._localMobiledoc = updatedMobileDoc;

activeSectionTagNames,
activeSectionAttributes
activeSectionAttributes,
});
}
};
// Avoid updating this component's properties synchronously while

@@ -390,3 +433,3 @@ // rendering the editor (after rendering the component) because it

getActiveMarkupTagNames(editor) {
return arrayToMap(editor.activeMarkups.map(m => m.tagName));
return arrayToMap(editor.activeMarkups.map((m) => m.tagName));
},

@@ -398,3 +441,3 @@

// can be bound.
let sectionParentTagNames = editor.activeSections.map(s => {
let sectionParentTagNames = editor.activeSections.map((s) => {
return s.isNested ? s.parent.tagName : s.tagName;

@@ -407,8 +450,9 @@ });

const sectionAttributes = {};
editor.activeSections.forEach(s => {
editor.activeSections.forEach((s) => {
let attributes = s.isNested ? s.parent.attributes : s.attributes;
Object.keys(attributes || {}).forEach(attrName => {
Object.keys(attributes || {}).forEach((attrName) => {
let camelizedAttrName = camelize(attrName.replace(/^data-md/, ''));
let attrValue = attributes[attrName];
sectionAttributes[camelizedAttrName] = sectionAttributes[camelizedAttrName] || [];
sectionAttributes[camelizedAttrName] =
sectionAttributes[camelizedAttrName] || [];
if (!sectionAttributes[camelizedAttrName].includes(attrValue)) {

@@ -422,6 +466,4 @@ sectionAttributes[camelizedAttrName].push(attrValue);

cursorDidChange(/*editor*/) {
cursorDidChange(/*editor*/) {},
},
willCreateEditor() {

@@ -440,8 +482,8 @@ if (this[WILL_CREATE_EDITOR_ACTION]) {

_addAtom(atomName, text, payload) {
let editor = this.get('editor');
let editor = this.editor;
editor.insertAtom(atomName, text, payload);
},
_addCard(cardName, payload, editMode=false) {
let editor = this.get('editor');
_addCard(cardName, payload, editMode = false) {
let editor = this.editor;
editor.insertCard(cardName, payload, editMode);

@@ -455,3 +497,3 @@ },

}
}
},
});

@@ -0,1 +1,4 @@

/* eslint-disable ember/no-classic-components */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
import { bool } from '@ember/object/computed';

@@ -13,5 +16,5 @@ import Component from '@ember/component';

click() {
let editor = this.get('editor');
let editor = this.editor;
editor.toggleLink();
}
},
});

@@ -0,1 +1,5 @@

/* eslint-disable ember/no-classic-components */
/* eslint-disable ember/no-component-lifecycle-hooks */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
import Component from '@ember/component';

@@ -8,4 +12,5 @@ import layout from './template';

didInsertElement() {
this._super(...arguments);
this.element.querySelector('input').focus();
}
},
});

@@ -0,1 +1,5 @@

/* eslint-disable ember/no-observers */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
/* eslint-disable ember/no-classic-components */
import { defineProperty, observer, computed } from '@ember/object';

@@ -16,9 +20,9 @@ import Component from '@ember/component';

},
onForDidChange: observer('for', function() {
onForDidChange: observer('for', function () {
this._updateIsActiveCP();
}),
_updateIsActiveCP() {
let forProperty = this.get('for');
let forProperty = this['for'];
let fullPath = `editor.activeMarkupTagNames.is${titleize(forProperty)}`;
let cp = computed(fullPath, function() {
let cp = computed(fullPath, function () {
return this.get(fullPath);

@@ -29,6 +33,6 @@ });

click() {
let editor = this.get('editor');
let forProperty = this.get('for');
let editor = this.editor;
let forProperty = this['for'];
editor.toggleMarkup(forProperty);
}
},
});

@@ -0,1 +1,5 @@

/* eslint-disable ember/no-classic-components */
/* eslint-disable ember/no-observers */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
import { defineProperty, observer, computed } from '@ember/object';

@@ -17,12 +21,20 @@ import Component from '@ember/component';

},
onNameOrValueDidChange: observer('attributeName', 'attributeValue', function() {
this._updateIsActiveCP();
}),
onNameOrValueDidChange: observer(
'attributeName',
'attributeValue',
function () {
this._updateIsActiveCP();
}
),
_updateIsActiveCP() {
let attributeName = this.get('attributeName');
let attributeName = this.attributeName;
let fullPath = `editor.activeSectionAttributes.${camelize(attributeName)}`;
let cp = computed(fullPath, 'attributeValue', function(){
let cp = computed(fullPath, 'attributeValue', 'editor', function () {
let activeValues = this.get(fullPath) || [];
let attributeValue = this.get('attributeValue');
return activeValues.includes(attributeValue) || (isEmpty(activeValues) && this.editor.isDefaultAttributeValue(attributeName, attributeValue));
let attributeValue = this.attributeValue;
return (
activeValues.includes(attributeValue) ||
(isEmpty(activeValues) &&
this.editor.isDefaultAttributeValue(attributeName, attributeValue))
);
});

@@ -32,7 +44,7 @@ defineProperty(this, 'isActive', cp);

click() {
let editor = this.get('editor');
let attributeName = this.get('attributeName');
let attributeValue = this.get('attributeValue');
let editor = this.editor;
let attributeName = this.attributeName;
let attributeValue = this.attributeValue;
editor.setAttribute(attributeName, attributeValue);
}
},
});

@@ -0,1 +1,5 @@

/* eslint-disable ember/no-classic-components */
/* eslint-disable ember/no-observers */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
import { defineProperty, observer, computed } from '@ember/object';

@@ -16,9 +20,9 @@ import Component from '@ember/component';

},
onForDidChange: observer('for', function() {
onForDidChange: observer('for', function () {
this._updateIsActiveCP();
}),
_updateIsActiveCP() {
let forProperty = this.get('for');
let forProperty = this['for'];
let fullPath = `editor.activeSectionTagNames.is${titleize(forProperty)}`;
let cp = computed(fullPath, function() {
let cp = computed(fullPath, function () {
return this.get(fullPath);

@@ -29,6 +33,6 @@ });

click() {
let editor = this.get('editor');
let forProperty = this.get('for');
let editor = this.editor;
let forProperty = this['for'];
editor.toggleSection(forProperty);
}
},
});

@@ -0,1 +1,4 @@

/* eslint-disable ember/no-classic-components */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
import Component from '@ember/component';

@@ -2,0 +5,0 @@ import layout from './template';

@@ -0,11 +1,14 @@

/* eslint-disable ember/no-component-lifecycle-hooks */
/* eslint-disable ember/require-tagless-components */
/* eslint-disable ember/no-classic-classes */
/* eslint-disable ember/no-classic-components */
import { schedule } from '@ember/runloop';
import { assert } from '@ember/debug';
import Component from '@ember/component';
import { computed } from '@ember/object'
import { computed } from '@ember/object';
import { htmlSafe } from '@ember/string';
import layout from './template';
const DIALOG_MARGIN = 16;
function isOutOfBounds (rect, boundingRect) {
function isOutOfBounds(rect, boundingRect) {
let result = {

@@ -15,9 +18,10 @@ left: rect.left < boundingRect.left,

top: rect.top < boundingRect.top,
bottom: rect.bottom > boundingRect.bottom
bottom: rect.bottom > boundingRect.bottom,
};
return (result.left || result.right || result.top || result.bottom) ? result : false;
return result.left || result.right || result.top || result.bottom
? result
: false;
}
export default Component.extend({
layout,
classNames: ['mobiledoc-selection-tether'],

@@ -28,11 +32,17 @@ attributeBindings: ['style'],

style: computed('dialogAnchor', function () {
let dialogAnchor = this.get('dialogAnchor')
return htmlSafe(`position: fixed; left: ${dialogAnchor.left}px; bottom: ${dialogAnchor.bottom}px;`)
let dialogAnchor = this.dialogAnchor;
return htmlSafe(
`position: fixed; left: ${dialogAnchor.left}px; bottom: ${dialogAnchor.bottom}px;`
);
}),
didReceiveAttrs() {
this._super();
let selection = window.getSelection();
let range = selection && selection.rangeCount && selection.getRangeAt(0);
assert('Should not render {{#tether-to-selection}} when there is no selection', !!range);
assert(
'Should not render {{#tether-to-selection}} when there is no selection',
!!range
);

@@ -46,3 +56,6 @@ if (range) {

let dialogAnchor = { left: rangeRect.left, bottom: window.innerHeight - rangeRect.top }
let dialogAnchor = {
left: rangeRect.left,
bottom: window.innerHeight - rangeRect.top,
};
this.set('dialogAnchor', dialogAnchor);

@@ -53,18 +66,39 @@ }

didInsertElement() {
this._super(...arguments);
schedule('afterRender', () => {
let boundingRect = { left: DIALOG_MARGIN, right: window.innerWidth - DIALOG_MARGIN, top: DIALOG_MARGIN, bottom: window.innerHeight - DIALOG_MARGIN };
let boundingRect = {
left: DIALOG_MARGIN,
right: window.innerWidth - DIALOG_MARGIN,
top: DIALOG_MARGIN,
bottom: window.innerHeight - DIALOG_MARGIN,
};
let dialogRect = this.element.getBoundingClientRect();
let isOffscreen = isOutOfBounds(dialogRect, boundingRect);
if (isOffscreen) {
let dialogAnchor = this.get('dialogAnchor');
this.element.setAttribute('style', `
let dialogAnchor = this.dialogAnchor;
this.element.setAttribute(
'style',
`
position: 'fixed';
left: ${isOffscreen.left ? DIALOG_MARGIN : (isOffscreen.right ? 'auto' : dialogAnchor.left)};
left: ${
isOffscreen.left
? DIALOG_MARGIN
: isOffscreen.right
? 'auto'
: dialogAnchor.left
};
right: ${isOffscreen.right ? DIALOG_MARGIN : 'auto'};
top: ${isOffscreen.top ? DIALOG_MARGIN : 'auto'};
bottom: ${isOffscreen.bottom ? DIALOG_MARGIN : (isOffscreen.top ? 'auto' : dialogAnchor.bottom)};
`);
bottom: ${
isOffscreen.bottom
? DIALOG_MARGIN
: isOffscreen.top
? 'auto'
: dialogAnchor.bottom
};
`
);
}
});
}
},
});
const RENDER_TYPE = 'dom';
import { ADD_ATOM_HOOK, REMOVE_ATOM_HOOK } from '../components/mobiledoc-editor/component';
import {
ADD_ATOM_HOOK,
REMOVE_ATOM_HOOK,
} from '../components/mobiledoc-editor/component';

@@ -13,3 +16,2 @@ function renderFallback(doc) {

export default function createComponentAtom(name, doc = window.document) {
return {

@@ -19,3 +21,3 @@ name,

render(atomArg) {
let {env, options} = atomArg;
let { env, options } = atomArg;
if (!options[ADD_ATOM_HOOK]) {

@@ -31,5 +33,4 @@ return renderFallback(doc);

return element;
}
},
};
}
const RENDER_TYPE = 'dom';
import { ADD_CARD_HOOK, REMOVE_CARD_HOOK } from '../components/mobiledoc-editor/component';
import {
ADD_CARD_HOOK,
REMOVE_CARD_HOOK,
} from '../components/mobiledoc-editor/component';

@@ -13,3 +16,2 @@ function renderFallback(doc) {

export default function createComponentCard(name, doc = window.document) {
return {

@@ -19,3 +21,3 @@ name,

render(cardArg) {
let {env, options} = cardArg;
let { env, options } = cardArg;
if (!options[ADD_CARD_HOOK]) {

@@ -33,3 +35,3 @@ return renderFallback(doc);

edit(cardArg) {
let {env, options} = cardArg;
let { env, options } = cardArg;
if (!options[ADD_CARD_HOOK]) {

@@ -46,5 +48,4 @@ return renderFallback(doc);

return element;
}
},
};
}
import { camelize, capitalize } from '@ember/string';
export default function(string) {
export default function (string) {
return capitalize(camelize(string));
}

@@ -1,8 +0,8 @@

import MOBILEDOC_KIT_VERSION from 'mobiledoc-kit/version';
import { VERSION as MOBILEDOC_KIT_VERSION } from 'mobiledoc-kit';
const EDITOR_VERSION = '0.4.3';
const VERSION = {
EDITOR_VERSION,
MOBILEDOC_KIT_VERSION
MOBILEDOC_KIT_VERSION,
};
export default VERSION;

@@ -1,1 +0,4 @@

export { default, mobiledocTitleize } from 'ember-mobiledoc-editor/helpers/mobiledoc-titleize';
export {
default,
mobiledocTitleize,
} from 'ember-mobiledoc-editor/helpers/mobiledoc-titleize';

@@ -1,17 +0,33 @@

## v0.7.0 (2022-10-24)
## v0.8.0 (2023-09-19)
#### :boom: Breaking Change
* [#203](https://github.com/bustle/ember-mobiledoc-editor/pull/203) Require node 10+. Update engine version to the one that allows yarn install to succeed ([@lukemelia](https://github.com/lukemelia))
* [#208](https://github.com/bustle/ember-mobiledoc-editor/pull/208) Update ember to 3.28 ([@lukemelia](https://github.com/lukemelia))
#### :rocket: Enhancement
* [#186](https://github.com/bustle/ember-mobiledoc-editor/pull/186) refactor: refactor jQuery usages to element selectors ([@srsgores](https://github.com/srsgores))
* [#208](https://github.com/bustle/ember-mobiledoc-editor/pull/208) Update ember to 3.28 ([@lukemelia](https://github.com/lukemelia))
#### Committers: 2
#### Committers: 1
- Luke Melia ([@lukemelia](https://github.com/lukemelia))
- Sean Goresht ([@srsgores](https://github.com/srsgores))
<a name="0.8.0"></a>
# 0.8.0 (2023-09-19)
* Add github actions CI ([0953619](https://github.com/bustle/ember-mobiledoc-editor/commit/0953619))
* Address lint errors ([9766b8a](https://github.com/bustle/ember-mobiledoc-editor/commit/9766b8a))
* Allow embroider-optimized build to fail for now ([97e205f](https://github.com/bustle/ember-mobiledoc-editor/commit/97e205f))
* Eliminate jquery usage ([101d39f](https://github.com/bustle/ember-mobiledoc-editor/commit/101d39f))
* Eliminate remaining deprecations ([6caef24](https://github.com/bustle/ember-mobiledoc-editor/commit/6caef24))
* Eliminate this-property-fallback deprecations ([bf8a22c](https://github.com/bustle/ember-mobiledoc-editor/commit/bf8a22c))
* Refactor away from reliance on getting the current Ember run loop ([ffefeb7](https://github.com/bustle/ember-mobiledoc-editor/commit/ffefeb7))
* Remove jquery dependency ([eee830d](https://github.com/bustle/ember-mobiledoc-editor/commit/eee830d))
* Remove unused file ([585b43e](https://github.com/bustle/ember-mobiledoc-editor/commit/585b43e))
* Replace usages of action helper ([7027350](https://github.com/bustle/ember-mobiledoc-editor/commit/7027350))
* WIP Upgrade to support ember 3.28 ([a716a52](https://github.com/bustle/ember-mobiledoc-editor/commit/a716a52))
<a name="0.7.0"></a>
# 0.7.0 (2022-10-24)
* Release 0.7.0 ([525aadb](https://github.com/bustle/ember-mobiledoc-editor/commit/525aadb))
* Update engine version to the one that allows yarn install to succeed ([0992db1](https://github.com/bustle/ember-mobiledoc-editor/commit/0992db1))

@@ -18,0 +34,0 @@ * refactor: refactor jQuery usages to element selectors ([95a2f7b](https://github.com/bustle/ember-mobiledoc-editor/commit/95a2f7b))

/* eslint-env node */
'use strict';
module.exports = function(/* environment, appConfig */) {
return { };
module.exports = function (/* environment, appConfig */) {
return {};
};
/* jshint node: true */
'use strict';
var MergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');
var path = require('path');
function distDirFor(packageName) {
try {
var resolved = require.resolve(packageName + '/package.json');
return path.join(path.dirname(resolved), 'dist');
} catch (e) {
return null;
}
}
module.exports = {
name: 'ember-mobiledoc-editor',
treeForVendor: function() {
var files = [];
files.push(new Funnel(distDirFor('mobiledoc-kit'), {
files: [
'css/mobiledoc-kit.css',
'amd/mobiledoc-kit.js',
'amd/mobiledoc-kit.map'
],
destDir: 'mobiledoc-kit'
}));
var rendererDir = distDirFor('mobiledoc-dom-renderer');
if (rendererDir) {
files.push(new Funnel(rendererDir, {
files: [
'amd/mobiledoc-dom-renderer.js',
'amd/mobiledoc-dom-renderer.map'
],
destDir: 'mobiledoc-dom-renderer'
}));
}
return new MergeTrees(files);
},
included: function(app) {
app.import('vendor/mobiledoc-kit/css/mobiledoc-kit.css');
app.import('vendor/mobiledoc-kit/amd/mobiledoc-kit.js');
var rendererDir = distDirFor('mobiledoc-dom-renderer');
if (rendererDir) {
app.import('vendor/mobiledoc-dom-renderer/amd/mobiledoc-dom-renderer.js');
}
}
name: require('./package').name,
};
{
"name": "ember-mobiledoc-editor",
"version": "0.7.0",
"version": "0.8.0",
"description": "A Mobiledoc editor for Ember.js apps",

@@ -16,7 +16,14 @@ "keywords": [

"scripts": {
"build": "ember build",
"lint:js": "eslint ./*.js addon addon-test-support app config lib server test-support tests",
"build": "ember build --environment=production",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"start": "ember serve",
"release": "release-it",
"test": "ember try:each",
"test": "npm-run-all lint test:*",
"test:ember": "ember test",
"test:ember-compatibility": "ember try:each",
"update-changelog": "conventional-changelog -i CHANGELOG.md -r 0 -s",

@@ -26,37 +33,57 @@ "version": "npm run update-changelog && git add CHANGELOG.md"

"dependencies": {
"broccoli-funnel": "^1.1.0",
"broccoli-merge-trees": "^2.0.0",
"ember-cli-babel": "^6.7.2",
"ember-cli-htmlbars": "^2.0.3",
"ember-wormhole": "^0.5.1",
"mobiledoc-dom-renderer": "^0.7.0",
"mobiledoc-kit": "~0.12.4"
"broccoli-funnel": "^3.0.8",
"broccoli-merge-trees": "^4.2.0",
"ember-auto-import": "^2.4.3",
"ember-cli-babel": "^7.26.10",
"ember-cli-htmlbars": "^5.7.2",
"ember-copy": "^2.0.1",
"ember-wormhole": "^0.6.0",
"mobiledoc-dom-renderer": "^0.7.2",
"mobiledoc-kit": "~0.15.0"
},
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.6.0",
"@embroider/test-setup": "^0.48.1",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"babel-eslint": "^10.1.0",
"bower": "^1.8.2",
"broccoli-asset-rev": "^2.4.5",
"broccoli-asset-rev": "^3.0.0",
"conventional-changelog": "^1.1.0",
"conventional-changelog-cli": "^1.1.0",
"ember-cli": "~2.18.0",
"ember-cli-dependency-checker": "^2.0.1",
"ember-cli-eslint": "^4.2.1",
"ember-cli-htmlbars-inline-precompile": "^1.0.2",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-qunit": "^4.1.1",
"ember-cli-shims": "^1.2.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^2.0.0",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.0.0",
"ember-source": "~3.0.0",
"eslint-plugin-ember": "^5.0.3",
"eslint-plugin-node": "^5.2.1",
"loader.js": "^4.2.3",
"ember-cli": "~3.28.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-deprecation-workflow": "^2.1.0",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.1",
"ember-load-initializers": "^2.1.2",
"ember-maybe-import-regenerator": "^1.0.0",
"ember-page-title": "^6.2.2",
"ember-qunit": "^5.1.5",
"ember-resolver": "^8.0.3",
"ember-source": "~3.28.8",
"ember-source-channel-url": "^3.0.0",
"ember-template-lint": "^3.15.0",
"ember-try": "^1.4.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ember": "^10.5.8",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-qunit": "^6.2.0",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"qunit": "^2.17.2",
"qunit-dom": "^1.6.0",
"release-it": "^13.6.0",
"release-it-lerna-changelog": "^2.3.0"
"release-it-lerna-changelog": "^2.3.0",
"webpack": "5"
},
"engines": {
"node": "^10.* || >= 11.*"
"node": "12.* || 14.* || >= 16"
},

@@ -66,2 +93,5 @@ "publishConfig": {

},
"ember": {
"edition": "octane"
},
"ember-addon": {

@@ -86,5 +116,5 @@ "configPath": "tests/dummy/config"

"volta": {
"node": "10.24.1",
"node": "12.22.12",
"yarn": "1.22.19"
}
}

@@ -394,7 +394,7 @@ ## ember-mobiledoc-editor

import { insertText, run } from '../../helpers/ember-mobiledoc-editor';
import { find } from '@enber/test-helpers';
test('visit /', function(assert) {
visit('/');
andThen(() => {
let editorEl = find('.mobiledoc-editor__editor')[0];
let editorEl = find('.mobiledoc-editor__editor');
return insertText(editorEl, 'here is some text');

@@ -415,7 +415,8 @@ /* Or:

See RELEASE.md
This README outlines the details of collaborating on this Ember addon.
To get started:
## Installation
* `git clone` this repository
* `git clone <repository-url>` this repository
* `cd ember-mobiledoc-editor`
* `yarn install`

@@ -425,14 +426,15 @@

* `ember server`
* Visit your app at http://localhost:4200.
* `ember serve`
* Visit your app at [http://localhost:4200](http://localhost:4200).
Run tests:
## Running Tests
* `yarn test` (Runs `ember try:each` to test your addon against multiple Ember versions)
* `ember test`
* `ember test --server`
Build to `dist/`:
## Building
* `ember build`
For more information on using ember-cli, visit [http://ember-cli.com/](http://ember-cli.com/).
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).

@@ -6,3 +6,3 @@ import { Promise as EmberPromise } from 'rsvp';

do {
if (element[TESTING_EXPANDO_PROPERTY] ) {
if (element[TESTING_EXPANDO_PROPERTY]) {
return element[TESTING_EXPANDO_PROPERTY];

@@ -18,5 +18,5 @@ }

let editor = findEditor(element);
return new EmberPromise(resolve => {
return new EmberPromise((resolve) => {
let { post } = editor;
editor.run(postEditor => {
editor.run((postEditor) => {
if (editor.post.isBlank) {

@@ -37,5 +37,5 @@ let section = postEditor.builder.createMarkupSection('p');

return new EmberPromise(resolve => {
return new EmberPromise((resolve) => {
requestAnimationFrame(resolve);
});
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc