Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Fixed Ember.copy deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinansfield committed Jan 30, 2019
1 parent f6cc56f commit 18dd5e3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/components/gh-token-input/trigger.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions lib/koenig-editor/addon/components/koenig-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions lib/koenig-editor/addon/components/koenig-slash-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 18dd5e3

Please sign in to comment.