Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import { IMAGE_ALIGNMENT_OPTIONS } from "../../utils";
type Props = {
activeAlignment: TCustomImageAlignment;
handleChange: (alignment: TCustomImageAlignment) => void;
isTouchDevice: boolean;
toggleToolbarViewStatus: (val: boolean) => void;
};

export const ImageAlignmentAction: React.FC<Props> = (props) => {
const { activeAlignment, handleChange, toggleToolbarViewStatus } = props;
const { activeAlignment, handleChange, isTouchDevice, toggleToolbarViewStatus } = props;
// states
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
// refs
Expand All @@ -30,7 +31,7 @@ export const ImageAlignmentAction: React.FC<Props> = (props) => {

return (
<div ref={dropdownRef} className="h-full relative">
<Tooltip tooltipContent="Align">
<Tooltip disabled={isTouchDevice} tooltipContent="Align">
<button
type="button"
className="h-full flex items-center gap-1 text-white/60 hover:text-white transition-colors"
Expand All @@ -43,7 +44,7 @@ export const ImageAlignmentAction: React.FC<Props> = (props) => {
{isDropdownOpen && (
<div className="absolute top-full left-1/2 -translate-x-1/2 mt-0.5 h-7 bg-black/80 flex items-center gap-2 px-2 rounded">
{IMAGE_ALIGNMENT_OPTIONS.map((option) => (
<Tooltip key={option.value} tooltipContent={option.label}>
<Tooltip disabled={isTouchDevice} key={option.value} tooltipContent={option.label}>
<button
type="button"
className="flex-shrink-0 h-full grid place-items-center text-white/60 hover:text-white transition-colors"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const ImageToolbarRoot: React.FC<Props> = (props) => {
<ImageAlignmentAction
activeAlignment={alignment}
handleChange={handleAlignmentChange}
isTouchDevice={isTouchDevice}
toggleToolbarViewStatus={setShouldShowToolbar}
/>
)}
Expand Down
6 changes: 6 additions & 0 deletions packages/editor/src/styles/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,9 @@ span[data-name][data-type="emoji"] img {
max-width: 1.25em;
max-height: 1.25em;
}

/* touch device styles */
.touch-select-none {
user-select: none;
-webkit-user-select: none;
}
Loading