You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

2 years ago
import { UIPanel, UIRow, UISelect, UISpan, UIText } from './libs/ui.js';
import { SidebarSettingsViewport } from './Sidebar.Settings.Viewport.js';
import { SidebarSettingsShortcuts } from './Sidebar.Settings.Shortcuts.js';
import { SidebarSettingsHistory } from './Sidebar.Settings.History.js';
function SidebarSettings( editor ) {
const config = editor.config;
const strings = editor.strings;
const container = new UISpan();
const settings = new UIPanel();
settings.setBorderTop( '0' );
settings.setPaddingTop( '20px' );
container.add( settings );
// language
const options = {
en: 'English',
fr: 'Français',
zh: '中文'
};
const languageRow = new UIRow();
const language = new UISelect().setWidth( '150px' );
language.setOptions( options );
if ( config.getKey( 'language' ) !== undefined ) {
language.setValue( config.getKey( 'language' ) );
}
language.onChange( function () {
const value = this.getValue();
editor.config.setKey( 'language', value );
} );
languageRow.add( new UIText( strings.getKey( 'sidebar/settings/language' ) ).setWidth( '90px' ) );
languageRow.add( language );
settings.add( languageRow );
//
container.add( new SidebarSettingsViewport( editor ) );
container.add( new SidebarSettingsShortcuts( editor ) );
container.add( new SidebarSettingsHistory( editor ) );
return container;
}
export { SidebarSettings };