mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed Ember.copy deprecations
refs https://github.com/TryGhost/Ghost/issues/10310 - https://emberjs.com/deprecations/v3.x/#toc_ember-runtime-deprecate-copy-copyable
This commit is contained in:
parent
aa16b385f6
commit
6fe40b941b
4 changed files with 5 additions and 8 deletions
|
@ -1,6 +1,5 @@
|
||||||
import EmberPowerSelectMultipleTrigger from 'ember-power-select/components/power-select-multiple/trigger';
|
import EmberPowerSelectMultipleTrigger from 'ember-power-select/components/power-select-multiple/trigger';
|
||||||
import {assert} from '@ember/debug';
|
import {assert} from '@ember/debug';
|
||||||
import {copy} from '@ember/object/internals';
|
|
||||||
import {get} from '@ember/object';
|
import {get} from '@ember/object';
|
||||||
import {isBlank} from '@ember/utils';
|
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
|
// ember-drag-drop's sortable-objects has two-way bindings and will
|
||||||
// update EPS' selected value directly. We have to create a copy
|
// update EPS' selected value directly. We have to create a copy
|
||||||
// after sorting in order to force the onchange action to be triggered
|
// 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
|
// copied directly from EPS, the default behaviour of stopping propagation
|
||||||
|
|
|
@ -6,7 +6,6 @@ import isNumber from 'ghost-admin/utils/isNumber';
|
||||||
import {alias, mapBy} from '@ember/object/computed';
|
import {alias, mapBy} from '@ember/object/computed';
|
||||||
import {computed} from '@ember/object';
|
import {computed} from '@ember/object';
|
||||||
import {inject as controller} from '@ember/controller';
|
import {inject as controller} from '@ember/controller';
|
||||||
import {copy} from '@ember/object/internals';
|
|
||||||
import {htmlSafe} from '@ember/string';
|
import {htmlSafe} from '@ember/string';
|
||||||
import {isBlank} from '@ember/utils';
|
import {isBlank} from '@ember/utils';
|
||||||
import {isArray as isEmberArray} from '@ember/array';
|
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
|
// 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
|
// nested objects/arrays don't keep references which can mean that both
|
||||||
// scratch and mobiledoc get updated simultaneously
|
// 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);
|
this.set('post.status', status);
|
||||||
|
|
||||||
// Set a default title
|
// Set a default title
|
||||||
|
|
|
@ -22,7 +22,6 @@ import {A} from '@ember/array';
|
||||||
import {MOBILEDOC_VERSION} from 'mobiledoc-kit/renderers/mobiledoc';
|
import {MOBILEDOC_VERSION} from 'mobiledoc-kit/renderers/mobiledoc';
|
||||||
import {assign} from '@ember/polyfills';
|
import {assign} from '@ember/polyfills';
|
||||||
import {camelize, capitalize} from '@ember/string';
|
import {camelize, capitalize} from '@ember/string';
|
||||||
import {copy} from '@ember/object/internals';
|
|
||||||
import {getContentFromPasteEvent} from 'mobiledoc-kit/utils/parse-utils';
|
import {getContentFromPasteEvent} from 'mobiledoc-kit/utils/parse-utils';
|
||||||
import {getLinkMarkupFromRange} from '../utils/markup-utils';
|
import {getLinkMarkupFromRange} from '../utils/markup-utils';
|
||||||
import {getOwner} from '@ember/application';
|
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
|
// `payload.files` is special because it's set by paste/drag-n-drop
|
||||||
// events and can't be copied for security reasons
|
// events and can't be copied for security reasons
|
||||||
let {files} = payload;
|
let {files} = payload;
|
||||||
let payloadCopy = copy(payload, true);
|
let payloadCopy = JSON.parse(JSON.stringify(payload));
|
||||||
payloadCopy.files = files;
|
payloadCopy.files = files;
|
||||||
|
|
||||||
// all of the properties that will be passed through to the
|
// all of the properties that will be passed through to the
|
||||||
|
|
|
@ -3,7 +3,6 @@ import layout from '../templates/components/koenig-slash-menu';
|
||||||
import {CARD_MENU} from '../options/cards';
|
import {CARD_MENU} from '../options/cards';
|
||||||
import {assign} from '@ember/polyfills';
|
import {assign} from '@ember/polyfills';
|
||||||
import {computed, set} from '@ember/object';
|
import {computed, set} from '@ember/object';
|
||||||
import {copy} from '@ember/object/internals';
|
|
||||||
import {htmlSafe} from '@ember/string';
|
import {htmlSafe} from '@ember/string';
|
||||||
import {isEmpty} from '@ember/utils';
|
import {isEmpty} from '@ember/utils';
|
||||||
import {run} from '@ember/runloop';
|
import {run} from '@ember/runloop';
|
||||||
|
@ -164,7 +163,7 @@ export default Component.extend({
|
||||||
}).compact();
|
}).compact();
|
||||||
|
|
||||||
// we need a copy to avoid modifying the object references
|
// 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) {
|
if (sections.length) {
|
||||||
set(sections[0].items[0], 'selected', true);
|
set(sections[0].items[0], 'selected', true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue