Kevin Ansfield 2019-01-30 10:13:21 +00:00
parent f6cc56f35b
commit 18dd5e34f6
4 changed files with 5 additions and 8 deletions

View File

@ -1,6 +1,5 @@
import EmberPowerSelectMultipleTrigger from 'ember-power-select/components/power-select-multiple/trigger';
import {assert} from '@ember/debug';
import {copy} from '@ember/object/internals';
import {get} from '@ember/object';
import {isBlank} from '@ember/utils';
@ -31,7 +30,8 @@ export default EmberPowerSelectMultipleTrigger.extend({
// ember-drag-drop's sortable-objects has two-way bindings and will
// update EPS' selected value directly. We have to create a copy
// after sorting in order to force the onchange action to be triggered
this.get('select').actions.select(copy(this.get('select.selected')));
let selectedCopy = this.select.selected.slice();
this.get('select').actions.select(selectedCopy);
},
// copied directly from EPS, the default behaviour of stopping propagation

View File

@ -6,7 +6,6 @@ import isNumber from 'ghost-admin/utils/isNumber';
import {alias, mapBy} from '@ember/object/computed';
import {computed} from '@ember/object';
import {inject as controller} from '@ember/controller';
import {copy} from '@ember/object/internals';
import {htmlSafe} from '@ember/string';
import {isBlank} from '@ember/utils';
import {isArray as isEmberArray} from '@ember/array';
@ -319,7 +318,7 @@ export default Controller.extend({
// set mobiledoc equal to what's in the editor but create a copy so that
// nested objects/arrays don't keep references which can mean that both
// scratch and mobiledoc get updated simultaneously
this.set('post.mobiledoc', copy(this.get('post.scratch'), true));
this.set('post.mobiledoc', JSON.parse(JSON.stringify(this.post.scratch)));
this.set('post.status', status);
// Set a default title

View File

@ -22,7 +22,6 @@ import {A} from '@ember/array';
import {MOBILEDOC_VERSION} from 'mobiledoc-kit/renderers/mobiledoc';
import {assign} from '@ember/polyfills';
import {camelize, capitalize} from '@ember/string';
import {copy} from '@ember/object/internals';
import {getContentFromPasteEvent} from 'mobiledoc-kit/utils/parse-utils';
import {getLinkMarkupFromRange} from '../utils/markup-utils';
import {getOwner} from '@ember/application';
@ -313,7 +312,7 @@ export default Component.extend({
// `payload.files` is special because it's set by paste/drag-n-drop
// events and can't be copied for security reasons
let {files} = payload;
let payloadCopy = copy(payload, true);
let payloadCopy = JSON.parse(JSON.stringify(payload));
payloadCopy.files = files;
// all of the properties that will be passed through to the

View File

@ -3,7 +3,6 @@ import layout from '../templates/components/koenig-slash-menu';
import {CARD_MENU} from '../options/cards';
import {assign} from '@ember/polyfills';
import {computed, set} from '@ember/object';
import {copy} from '@ember/object/internals';
import {htmlSafe} from '@ember/string';
import {isEmpty} from '@ember/utils';
import {run} from '@ember/runloop';
@ -164,7 +163,7 @@ export default Component.extend({
}).compact();
// we need a copy to avoid modifying the object references
let sections = copy(matchedItems, true);
let sections = JSON.parse(JSON.stringify(matchedItems));
if (sections.length) {
set(sections[0].items[0], 'selected', true);