Sidebar.Settings.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { UIPanel, UIRow, UISelect, UISpan, UIText } from './libs/ui.js';
  2. import { SidebarSettingsShortcuts } from './Sidebar.Settings.Shortcuts.js';
  3. import { SidebarSettingsHistory } from './Sidebar.Settings.History.js';
  4. function SidebarSettings( editor ) {
  5. const config = editor.config;
  6. const strings = editor.strings;
  7. const container = new UISpan();
  8. const settings = new UIPanel();
  9. settings.setBorderTop( '0' );
  10. settings.setPaddingTop( '20px' );
  11. container.add( settings );
  12. // language
  13. const options = {
  14. en: 'English',
  15. fr: 'Français',
  16. zh: '中文',
  17. ja: '日本語',
  18. ko: '한국어',
  19. };
  20. const languageRow = new UIRow();
  21. const language = new UISelect().setWidth( '150px' );
  22. language.setOptions( options );
  23. if ( config.getKey( 'language' ) !== undefined ) {
  24. language.setValue( config.getKey( 'language' ) );
  25. }
  26. language.onChange( function () {
  27. const value = this.getValue();
  28. editor.config.setKey( 'language', value );
  29. } );
  30. languageRow.add( new UIText( strings.getKey( 'sidebar/settings/language' ) ).setClass( 'Label' ) );
  31. languageRow.add( language );
  32. settings.add( languageRow );
  33. //
  34. container.add( new SidebarSettingsShortcuts( editor ) );
  35. container.add( new SidebarSettingsHistory( editor ) );
  36. return container;
  37. }
  38. export { SidebarSettings };
粤ICP备19079148号