mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-07 09:49:41 +09:00
Fix and enhance comment editor monospace toggle (#36181)
Fixes: https://github.com/go-gitea/gitea/issues/36175 1. Correctly apply setting on textareas spawned by comment edit 3. When changing the setting, apply it to all textareas on the current page --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {renderAnsi} from '../render/ansi.ts';
|
||||
import {POST, DELETE} from '../modules/fetch.ts';
|
||||
import type {IntervalId} from '../types.ts';
|
||||
import {toggleFullScreen} from '../utils.ts';
|
||||
import {localUserSettings} from '../modules/user-settings.ts';
|
||||
|
||||
// see "models/actions/status.go", if it needs to be used somewhere else, move it to a shared file like "types/actions.ts"
|
||||
type RunStatus = 'unknown' | 'waiting' | 'running' | 'success' | 'failure' | 'cancelled' | 'skipped' | 'blocked';
|
||||
@@ -71,15 +72,6 @@ type LocaleStorageOptions = {
|
||||
expandRunning: boolean;
|
||||
};
|
||||
|
||||
function getLocaleStorageOptions(): LocaleStorageOptions {
|
||||
try {
|
||||
const optsJson = localStorage.getItem('actions-view-options');
|
||||
if (optsJson) return JSON.parse(optsJson);
|
||||
} catch {}
|
||||
// if no options in localStorage, or failed to parse, return default options
|
||||
return {autoScroll: true, expandRunning: false};
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'RepoActionView',
|
||||
components: {
|
||||
@@ -106,7 +98,8 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
data() {
|
||||
const {autoScroll, expandRunning} = getLocaleStorageOptions();
|
||||
const defaultViewOptions: LocaleStorageOptions = {autoScroll: true, expandRunning: false};
|
||||
const {autoScroll, expandRunning} = localUserSettings.getJsonObject('actions-view-options', defaultViewOptions);
|
||||
return {
|
||||
// internal state
|
||||
loadingAbortController: null as AbortController | null,
|
||||
@@ -224,7 +217,7 @@ export default defineComponent({
|
||||
methods: {
|
||||
saveLocaleStorageOptions() {
|
||||
const opts: LocaleStorageOptions = {autoScroll: this.optionAlwaysAutoScroll, expandRunning: this.optionAlwaysExpandRunning};
|
||||
localStorage.setItem('actions-view-options', JSON.stringify(opts));
|
||||
localUserSettings.setJsonObject('actions-view-options', opts);
|
||||
},
|
||||
|
||||
// get the job step logs container ('.job-step-logs')
|
||||
|
||||
Reference in New Issue
Block a user