Skip to content

Commit 2003a58

Browse files
committed
feat(rich-text-web): edit icons
1 parent edd0cc5 commit 2003a58

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

packages/pluggableWidgets/rich-text-web/src/components/Editor.tsx

+21-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,27 @@ const Editor = forwardRef((props: EditorProps, ref: MutableRefObject<Quill | nul
111111
}
112112
}
113113
: false,
114-
resize: {}
114+
resize: {
115+
tools: [
116+
"left",
117+
"center",
118+
"right",
119+
"full",
120+
{
121+
text: "Alt",
122+
verify(activeEle: HTMLElement) {
123+
return activeEle && activeEle.tagName === "IMG";
124+
},
125+
handler(_evt: MouseEvent, _button: HTMLElement, activeEle: HTMLImageElement) {
126+
const alt = activeEle.alt || "";
127+
const newAlt = window.prompt("Alt for image", alt);
128+
if (typeof newAlt === "string") {
129+
activeEle.setAttribute("alt", newAlt);
130+
}
131+
}
132+
}
133+
]
134+
}
115135
},
116136
readOnly
117137
};

packages/pluggableWidgets/rich-text-web/src/ui/RichTextIcons.scss

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ $icons: (
4343
Inline-code: "\e923",
4444
View-edit-code: "\e924",
4545
Code-block: "\e923",
46-
Resize-left: "\e923",
47-
Resize-right: "\e923",
48-
Resize-center: "\e923",
49-
Resize-restore: "\e923",
50-
Resize-alt: "\e923"
46+
Resize-left: "\e906",
47+
Resize-right: "\e907",
48+
Resize-center: "\e908",
49+
Resize-restore: "\e909",
50+
Resize-alt: "\e905"
5151
);
5252

5353
.widget-rich-text {

0 commit comments

Comments
 (0)