@yorkjs/hive-ui 2.2.5 → 2.2.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorkjs/hive-ui",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "description": "Hive UI - Taro React component library",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -68,6 +68,9 @@
68
68
  .align-btn
69
69
  padding 4PX
70
70
  flexHVCenter()
71
+ &.is-disabled
72
+ opacity 0.4
73
+ pointer-events none
71
74
 
72
75
  .image-block
73
76
  overflow hidden
@@ -123,16 +123,25 @@ const RichTextEditor: React.FC<RichTextEditorProps> = (props) => {
123
123
  <View className={styles['align-toolbar']}>
124
124
  {ALIGN_OPTIONS.map((align) => {
125
125
  const active = (block.align || 'left') === align
126
+ const disabled = !block.content?.trim()
126
127
  return (
127
128
  <View
128
129
  key={align}
129
- className={styles['align-btn']}
130
- onClick={() => handleAlignChange(index, align)}
130
+ className={formatClassNames(
131
+ styles['align-btn'],
132
+ disabled ? styles['is-disabled'] : ''
133
+ )}
134
+ onClick={() => {
135
+ if (disabled) return
136
+ handleAlignChange(index, align)
137
+ }}
131
138
  >
132
139
  <Icon
133
140
  name={`align-${align}`}
134
141
  size={16}
135
- color={active ? 'var(--textTitle)' : 'var(--textMuted)'}
142
+ color={disabled
143
+ ? 'var(--textMuted)'
144
+ : active ? 'var(--textTitle)' : 'var(--textMuted)'}
136
145
  />
137
146
  </View>
138
147
  )