@sveltia/ui 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@
68
68
  const selectionBlockType = writable('paragraph');
69
69
  const selectionInlineTypes = writable([]);
70
70
  const editorId = writable(generateElementId('editor'));
71
- const useRichText = writable(modes.includes('rich-text'));
71
+ const useRichText = writable(modes[0] === 'rich-text');
72
72
  const hasConverterError = writable(false);
73
73
  let showConverterError = false;
74
74
 
@@ -6,8 +6,8 @@
6
6
  import Spacer from '../../divider/spacer.svelte';
7
7
  import Icon from '../../icon/icon.svelte';
8
8
  import MenuButton from '../../menu/menu-button.svelte';
9
- import MenuItemCheckbox from '../../menu/menu-item-checkbox.svelte';
10
9
  import Menu from '../../menu/menu.svelte';
10
+ import Switch from '../../switch/switch.svelte';
11
11
  import {
12
12
  availableButtons,
13
13
  blockButtonTypes,
@@ -99,29 +99,20 @@
99
99
  {/if}
100
100
  <Spacer flex />
101
101
  {#if modes.length > 1}
102
- <MenuButton
103
- variant="ghost"
104
- iconic
102
+ <Switch
105
103
  disabled={$hasConverterError}
106
- popupPosition="bottom-right"
107
- aria-label={$_('_sui.text_editor.show_edit_options')}
108
- >
109
- <Icon slot="start-icon" name="more_vert" />
110
- <Menu slot="popup" aria-label={$_('_sui.text_editor.edit_options')}>
111
- <MenuItemCheckbox
112
- label={$_('_sui.text_editor.use_rich_text')}
113
- bind:checked={$useRichText}
114
- on:change={async () => {
115
- // Wait for `$useRichText` to be updated
116
- await tick();
104
+ bind:checked={$useRichText}
105
+ label={$_('_sui.text_editor.rich_text')}
106
+ aria-label={$_('_sui.text_editor.use_rich_text_mode')}
107
+ on:change={async () => {
108
+ // Wait for `$useRichText` to be updated
109
+ await tick();
117
110
 
118
- if ($useRichText) {
119
- convertMarkdown();
120
- }
121
- }}
122
- />
123
- </Menu>
124
- </MenuButton>
111
+ if ($useRichText) {
112
+ convertMarkdown();
113
+ }
114
+ }}
115
+ />
125
116
  {/if}
126
117
  </Toolbar>
127
118
  </div>
@@ -141,7 +132,10 @@
141
132
  padding: 8px;
142
133
  background-color: var(--sui-tertiary-background-color);
143
134
  }
144
- .wrapper :global(button) {
135
+ .wrapper :global(.sui.menu-button) {
136
+ padding: 0 4px;
137
+ }
138
+ .wrapper :global(.sui.button) {
145
139
  flex: none;
146
140
  margin: 0 !important;
147
141
  }
@@ -57,9 +57,8 @@ export namespace strings {
57
57
  export const update_link: string;
58
58
  export const text: string;
59
59
  export const url: string;
60
- export const edit_options: string;
61
- export const show_edit_options: string;
62
- export const use_rich_text: string;
60
+ export const rich_text: string;
61
+ export const use_rich_text_mode: string;
63
62
  export const converter_error: string;
64
63
  }
65
64
  }
@@ -56,9 +56,8 @@ export const strings = {
56
56
  update_link: 'Update Link',
57
57
  text: 'Text',
58
58
  url: 'URL',
59
- edit_options: 'Edit Options',
60
- show_edit_options: 'Show Edit Options',
61
- use_rich_text: 'Use Rich Text',
59
+ rich_text: 'Rich Text',
60
+ use_rich_text_mode: 'Use Rich Text Mode',
62
61
  converter_error:
63
62
  'There was an error while enabling rich text mode. Please use the plain text editor instead.',
64
63
  },
@@ -57,9 +57,8 @@ export namespace strings {
57
57
  export const update_link: string;
58
58
  export const text: string;
59
59
  export const url: string;
60
- export const edit_options: string;
61
- export const show_edit_options: string;
62
- export const use_rich_text: string;
60
+ export const rich_text: string;
61
+ export const use_rich_text_mode: string;
63
62
  export const converter_error: string;
64
63
  }
65
64
  }
@@ -56,9 +56,8 @@ export const strings = {
56
56
  update_link: 'リンクを更新',
57
57
  text: 'テキスト',
58
58
  url: 'URL',
59
- edit_options: '編集オプション',
60
- show_edit_options: '編集オプションを表示',
61
- use_rich_text: 'リッチテキストを使用',
59
+ rich_text: 'リッチテキスト',
60
+ use_rich_text_mode: 'リッチテキストモードを使用',
62
61
  converter_error:
63
62
  'リッチテキストモードを有効化中に問題が発生しました。代わりにプレーンテキストエディターを使用してください。',
64
63
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -32,7 +32,7 @@
32
32
  "@lexical/selection": "^0.14.5",
33
33
  "@lexical/table": "^0.14.5",
34
34
  "@lexical/utils": "^0.14.5",
35
- "@sveltia/utils": "^0.1.0",
35
+ "@sveltia/utils": "^0.1.1",
36
36
  "lexical": "^0.14.5",
37
37
  "svelte": "^4.2.15"
38
38
  },