Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lively.ide/tests/components/reconciliation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ describe('component -> source reconciliation', function () {
});

it('updates the layouts definitions in response to a morph getting removed', async () => {
ComponentB.withMetaDo({ reconcileChanges: true }, async () => {
ComponentB.withMetaDo({ reconcileChanges: true }, () => {
ComponentB.layout = new TilingLayout({
resizePolicies: [
['some submorph', { height: 'fill', width: 'fill' }]
Expand All @@ -311,7 +311,7 @@ describe('component -> source reconciliation', function () {
});`);

let removedMorph;
ComponentB.withMetaDo({ reconcileChanges: true }, async () => {
ComponentB.withMetaDo({ reconcileChanges: true }, () => {
removedMorph = ComponentB.getSubmorphNamed('some submorph').remove();
});
await ComponentB._changeTracker.onceChangesProcessed();
Expand Down
8 changes: 5 additions & 3 deletions lively.ide/tests/js/browser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ describe('system browser client/server switching', function () {
const directory = resource(System.baseURL).join('.' + name).asDirectory();
const remoteDirectory = resource((await remote.getConfig()).baseURL).join('.' + name).asDirectory();
const manifest = directory.join('package.json');
// Server writes can share a Last-Modified timestamp with the browser's cached copy.
const readManifest = async () => (await fetch(manifest.url, { cache: 'no-store' })).json();
const config = {
name, version: '1.0.0', main: 'nested/shared.js', description: 'Preserve me',
lively: {
Expand All @@ -96,13 +98,13 @@ describe('system browser client/server switching', function () {
expect(control.viewModel.listMorph.items.map(item => item.value)).deep.equals(['client', 'shared', 'server']);
expect(browser.selectedModule?.url).equals(directory.join('nested/shared.js').url);
expect(control.selection, 'initial module environment').equals('client');
expect(await manifest.readJson(), 'synchronizing the dropdown must not edit package.json').deep.equals(config);
expect(await readManifest(), 'synchronizing the dropdown must not edit package.json').deep.equals(config);
const choose = async mode => {
control.selection = mode;
await promise.waitFor(60000, () => !browser.state.isChangingModuleEnvironment && !control.viewModel.deactivated);
expect(control.selection).equals(mode);
expect(control.get('label').textString).includes({client: 'Client-only', shared: 'Shared', server: 'Server-only'}[mode]);
const saved = await manifest.readJson();
const saved = await readManifest();
const environments = { client: ['client'], shared: ['client', 'server'], server: ['server'] }[mode];
expect(saved.lively.meta['nested/shared.js'].environments).deep.equals(environments);
expect(saved.description).equals(config.description);
Expand Down Expand Up @@ -143,7 +145,7 @@ describe('system browser client/server switching', function () {
expect(await browser.setModuleEnvironment('server')).equals(false);
expect(browser.ui.sourceEditor.textString).equals(unsaved);
expect(control.selection).equals('shared');
expect((await manifest.readJson()).lively.meta['nested/shared.js'].environments).deep.equals(['client', 'server']);
expect((await readManifest()).lively.meta['nested/shared.js'].environments).deep.equals(['client', 'server']);
let confirmations = 0;
browser.warnForUnsavedChanges = async () => { confirmations++; return true; };
expect(await browser.setModuleEnvironment('server')).equals(true);
Expand Down
43 changes: 20 additions & 23 deletions lively.ide/text/rich-text-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,14 @@ export const interactiveCommands = [
name: 'change font',
scrollCursorIntoView: false,
exec: async function (morph) {
morph.withMetaDo({ reconcileChanges: true }, async () => {
const fonts = availableFonts().map(font => font.name);

const res = await $world.listPrompt('choose font', fonts, {
requester: morph,
preselect: fonts.indexOf(morph.fontFamily),
historyId: 'lively.morpic/text-change-font-hist'
});

if (res.status !== 'accepted') return false;

const fonts = availableFonts().map(font => font.name);
const res = await $world.listPrompt('choose font', fonts, {
requester: morph,
preselect: fonts.indexOf(morph.fontFamily),
historyId: 'lively.morpic/text-change-font-hist'
});
if (res.status !== 'accepted') return false;
return morph.withMetaDo({ reconcileChanges: true }, () => {
morph.fontFamily = res.selected[0];
return true;
});
Expand All @@ -154,17 +151,17 @@ export const interactiveCommands = [
name: 'set link of selection',
scrollCursorIntoView: false,
exec: async function (morph, args = {}) {
let link;
morph.withMetaDo({ reconcileChanges: true }, async () => {
if (!args.hasOwnProperty('link')) {
const sel = morph.selection;
const { link: oldLink } = morph.getStyleInRange(sel);
link = await morph.world().prompt('Set link', {
input: oldLink || 'https://',
historyId: 'lively.morphic-rich-text-link-hist'
});
if (!link) return;
}
const sel = morph.selection;
let link = args.link;
if (!args.hasOwnProperty('link')) {
const { link: oldLink } = morph.getStyleInRange(sel);
link = await morph.world().prompt('Set link', {
input: oldLink || 'https://',
historyId: 'lively.morphic-rich-text-link-hist'
});
if (!link) return;
}
return morph.withMetaDo({ reconcileChanges: true }, () => {
morph.undoManager.group();
morph.setStyleInRange({ link: link || undefined }, sel);
morph.undoManager.group();
Expand Down Expand Up @@ -211,7 +208,7 @@ export const interactiveCommands = [
name: 'reset text style',
scrollCursorIntoView: false,
exec: function (morph, args = {}) {
morph.withMetaDo({ reconcileChanges: true }, async () => {
return morph.withMetaDo({ reconcileChanges: true }, () => {
morph.undoManager.group();
const range = !args.onlySelection && morph.selection.isEmpty()
? morph.documentRange
Expand Down
Loading
Loading