Sidebar.Settings.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. };
  18. const languageRow = new UIRow();
  19. const language = new UISelect().setWidth( '150px' );
  20. language.setOptions( options );
  21. if ( config.getKey( 'language' ) !== undefined ) {
  22. language.setValue( config.getKey( 'language' ) );
  23. }
  24. language.onChange( function () {
  25. const value = this.getValue();
  26. editor.config.setKey( 'language', value );
  27. } );
  28. languageRow.add( new UIText( strings.getKey( 'sidebar/settings/language' ) ).setWidth( '90px' ) );
  29. languageRow.add( language );
  30. settings.add( languageRow );
  31. //
  32. container.add( new SidebarSettingsShortcuts( editor ) );
  33. container.add( new SidebarSettingsHistory( editor ) );
  34. return container;
  35. }
  36. export { SidebarSettings };