Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make activity changes textbox readonly #1370

Merged
merged 7 commits into from
Jan 14, 2025
Merged
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
2 changes: 1 addition & 1 deletion frontend/viewer/src/ProjectView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
{#if about}
<AboutDialog text={about} />
{/if}
{#if $features.feedback}
{#if $features.feedback && fwLiteConfig.feedbackUrl}
<Button
href={fwLiteConfig.feedbackUrl}
target="_blank"
Expand Down
7 changes: 7 additions & 0 deletions frontend/viewer/src/TestProjectView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
import ProjectView from './ProjectView.svelte';
import {InMemoryApiService} from '$lib/in-memory-api-service';
import {DotnetService} from '$lib/dotnet-types';
import {FwLitePlatform} from '$lib/dotnet-types/generated-types/FwLiteShared/FwLitePlatform';

const inMemoryLexboxApi = new InMemoryApiService();
window.lexbox.ServiceProvider.setService(DotnetService.MiniLcmApi, inMemoryLexboxApi);
window.lexbox.ServiceProvider.setService(DotnetService.FwLiteConfig, {
appVersion: 'test-project',
feedbackUrl: '',
os: FwLitePlatform.Web,
useDevAssets: true,
});
</script>
<ProjectView projectName={inMemoryLexboxApi.projectName} isConnected />
9 changes: 8 additions & 1 deletion frontend/viewer/src/WebComponent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import ProjectView from './ProjectView.svelte';
import { getSettings } from 'svelte-ux';
import css from './app.postcss?inline';
import {DotnetService} from '$lib/dotnet-types';
import {FwLitePlatform} from '$lib/dotnet-types/generated-types/FwLiteShared/FwLitePlatform';

let loading = true;

Expand Down Expand Up @@ -33,7 +35,12 @@
abortController.abort();
}
});

window.lexbox.ServiceProvider.setService(DotnetService.FwLiteConfig, {
appVersion: 'lexbox-viewer',
feedbackUrl: '',
os: FwLitePlatform.Web,
useDevAssets: true,//has no effect, but is required
});
const { currentTheme } = getSettings();
</script>

Expand Down
3 changes: 2 additions & 1 deletion frontend/viewer/src/lib/activity/ActivityView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@
{#if selectedRow}
<TextField label="Changes"
value={JSON.stringify(selectedRow.changes, null, 4)}
disabled
multiline
class="readonly"
class="readonly field"
classes={{input: 'h-80'}}/>
{/if}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,5 @@ export interface IMiniLcmJsInvokable
createExampleSentence(entryId: string, senseId: string, exampleSentence: IExampleSentence) : Promise<IExampleSentence>;
updateExampleSentence(entryId: string, senseId: string, before: IExampleSentence, after: IExampleSentence) : Promise<IExampleSentence>;
deleteExampleSentence(entryId: string, senseId: string, exampleSentenceId: string) : Promise<void>;
dispose() : Promise<void>;
}
/* eslint-enable */
38 changes: 24 additions & 14 deletions frontend/viewer/src/lib/entry-editor/field.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,33 @@
@apply col-span-2 pl-4;
}

.readonly {
&.TextField, .TextField {
opacity: 1;
&.TextField, .TextField {
[class~="border"] {
filter: contrast(0.95);
border-radius: 0;
border-style: none;
border-bottom-style: solid;
@apply !shadow-none;
border-color: hsl(var(--color-surface-content) / 30%);
}
}

[class~="border"] {
border: none;
}
&.readonly.TextField, .readonly.TextField, .readonly .TextField {
/* prevent other "disabled-state styles" from impacting readability */
opacity: 1;

input {
/* enable standard text selection */
pointer-events: auto;
cursor: text;
}
[class~="border"] {
border-color: hsl(var(--color-surface-content) / 20%);
background: transparent;
}

input {
/* enable standard text selection */
pointer-events: auto;
}

.append {
display: none;
}
.append, .prepend {
display: none;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
value={editorValue}
disabled={readonly}
options={sortedOptions}
icon={readonly ? undefined : mdiMagnify}
icon={mdiMagnify}
formatSelected={({ value, options }) => {
return (preserveOrder
// sorted by order of selection
Expand Down
6 changes: 3 additions & 3 deletions frontend/viewer/src/lib/history/HistoryView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
<div>
{#if record?.entity}
{#if record.entityName === 'Entry'}
<EntryEditor entry={record.entity} modalMode/>
<EntryEditor entry={record.entity} modalMode readonly/>
{:else if record.entityName === 'Sense'}
<div class="editor-grid">
<SenseEditor sense={record.entity}/>
<SenseEditor sense={record.entity} readonly/>
</div>
{:else if record.entityName === 'ExampleSentence'}
<div class="editor-grid">
<ExampleEditor example={record.entity} readonly={false}/>
<ExampleEditor example={record.entity} readonly/>
</div>
{/if}
{/if}
Expand Down
Loading