Skip to content

Commit c515b7f

Browse files
committed
fix: hide inline format toolbar when necessary
1 parent ac311c1 commit c515b7f

File tree

8 files changed

+260
-118
lines changed

8 files changed

+260
-118
lines changed

examples/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
</head>
99
<body>
1010
<div class="tools">
11+
<div class="language-selector">
12+
<label for="language-select">Language:</label>
13+
<select id="language-select">
14+
<option value="zh">中文</option>
15+
<option value="en">English</option>
16+
<option value="ja">日本語</option>
17+
</select>
18+
</div>
1119
<button id="undo">UNDO</button>
1220
<button id="redo">REDO</button>
1321
<input id="search" type="text" placeholder="Search text..." />

examples/src/main.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import type { TState } from '@muyajs/core';
33
import {
44
CodeBlockLanguageSelector,
55
EmojiSelector,
6+
en,
67
ImageEditTool,
78
ImageResizeBar,
89
ImageToolBar,
910
InlineFormatToolbar,
11+
ja,
1012
MarkdownToHtml,
1113
Muya,
1214
ParagraphFrontButton,
@@ -81,6 +83,23 @@ muya.locale(zh);
8183

8284
muya.init();
8385

86+
// Language switcher
87+
const languageSelect: HTMLSelectElement = document.querySelector('#language-select')!;
88+
languageSelect.addEventListener('change', (event) => {
89+
const lang = (event.target as HTMLSelectElement).value;
90+
switch (lang) {
91+
case 'en':
92+
muya.locale(en);
93+
break;
94+
case 'ja':
95+
muya.locale(ja);
96+
break;
97+
case 'zh':
98+
muya.locale(zh);
99+
break;
100+
}
101+
});
102+
84103
undoBtn.addEventListener('click', () => {
85104
muya.undo();
86105
});

examples/src/style.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,30 @@ input {
4343
margin-right: 10px;
4444
}
4545

46+
.language-selector {
47+
display: flex;
48+
align-items: center;
49+
gap: 8px;
50+
margin-right: 10px;
51+
}
52+
53+
.language-selector label {
54+
font-size: 14px;
55+
color: #333;
56+
white-space: nowrap;
57+
}
58+
59+
.language-selector select {
60+
height: 26px;
61+
padding: 0 8px;
62+
border: 1px solid #eee;
63+
border-radius: 4px;
64+
outline: none;
65+
background-color: #fff;
66+
cursor: pointer;
67+
font-size: 14px;
68+
}
69+
4670
.editor-container {
4771
width: 100vw;
4872
height: 100vh;

packages/core/src/assets/styles/blockSyntax.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ li.mu-task-list-item > input.mu-checkbox-checked::before,
363363
li.mu-task-list-item > span.mu-checkbox-checked::before {
364364
background: var(--icon-color);
365365
border-color: var(--icon-color);
366-
box-shadow: 0 2px 5px 0 var(--editor-color-30);
367366
}
368367

369368
/* table */

packages/core/src/config/emptyStates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const emptyStates = {
143143
{
144144
name: 'task-list-item',
145145
meta: {
146-
checked: true, // true or false
146+
checked: false, // true or false
147147
},
148148
children: [
149149
{

0 commit comments

Comments
 (0)