|
@@ -42,7 +42,7 @@ export const contextBarActionTypes = [
|
|
|
'LogseqPortalViewMode',
|
|
'LogseqPortalViewMode',
|
|
|
'ArrowMode',
|
|
'ArrowMode',
|
|
|
'OpenPage',
|
|
'OpenPage',
|
|
|
- 'References',
|
|
|
|
|
|
|
+ 'Links',
|
|
|
] as const
|
|
] as const
|
|
|
|
|
|
|
|
type ContextBarActionType = typeof contextBarActionTypes[number]
|
|
type ContextBarActionType = typeof contextBarActionTypes[number]
|
|
@@ -51,7 +51,7 @@ const singleShapeActions: ContextBarActionType[] = [
|
|
|
'YoutubeLink',
|
|
'YoutubeLink',
|
|
|
'IFrameSource',
|
|
'IFrameSource',
|
|
|
'OpenPage',
|
|
'OpenPage',
|
|
|
- 'References',
|
|
|
|
|
|
|
+ 'Links',
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
const contextBarActionMapping = new Map<ContextBarActionType, React.FC>()
|
|
const contextBarActionMapping = new Map<ContextBarActionType, React.FC>()
|
|
@@ -66,20 +66,20 @@ export const shapeMapping: Record<ShapeType, ContextBarActionType[]> = {
|
|
|
'ScaleLevel',
|
|
'ScaleLevel',
|
|
|
'OpenPage',
|
|
'OpenPage',
|
|
|
'AutoResizing',
|
|
'AutoResizing',
|
|
|
- 'References',
|
|
|
|
|
|
|
+ 'Links',
|
|
|
],
|
|
],
|
|
|
- youtube: ['YoutubeLink', 'References'],
|
|
|
|
|
- iframe: ['IFrameSource', 'References'],
|
|
|
|
|
- box: ['Swatch', 'NoFill', 'StrokeType', 'References'],
|
|
|
|
|
- ellipse: ['Swatch', 'NoFill', 'StrokeType', 'References'],
|
|
|
|
|
- polygon: ['Swatch', 'NoFill', 'StrokeType', 'References'],
|
|
|
|
|
- line: ['Edit', 'Swatch', 'ArrowMode', 'References'],
|
|
|
|
|
- pencil: ['Swatch', 'References'],
|
|
|
|
|
- highlighter: ['Swatch', 'References'],
|
|
|
|
|
- text: ['Edit', 'Swatch', 'ScaleLevel', 'AutoResizing', 'TextStyle', 'References'],
|
|
|
|
|
- html: ['ScaleLevel', 'AutoResizing', 'References'],
|
|
|
|
|
- image: ['References'],
|
|
|
|
|
- video: ['References'],
|
|
|
|
|
|
|
+ youtube: ['YoutubeLink', 'Links'],
|
|
|
|
|
+ iframe: ['IFrameSource', 'Links'],
|
|
|
|
|
+ box: ['Swatch', 'NoFill', 'StrokeType', 'Links'],
|
|
|
|
|
+ ellipse: ['Swatch', 'NoFill', 'StrokeType', 'Links'],
|
|
|
|
|
+ polygon: ['Swatch', 'NoFill', 'StrokeType', 'Links'],
|
|
|
|
|
+ line: ['Edit', 'Swatch', 'ArrowMode', 'Links'],
|
|
|
|
|
+ pencil: ['Swatch', 'Links'],
|
|
|
|
|
+ highlighter: ['Swatch', 'Links'],
|
|
|
|
|
+ text: ['Edit', 'Swatch', 'ScaleLevel', 'AutoResizing', 'TextStyle', 'Links'],
|
|
|
|
|
+ html: ['ScaleLevel', 'AutoResizing', 'Links'],
|
|
|
|
|
+ image: ['Links'],
|
|
|
|
|
+ video: ['Links'],
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const withFillShapes = Object.entries(shapeMapping)
|
|
export const withFillShapes = Object.entries(shapeMapping)
|
|
@@ -500,7 +500,7 @@ const TextStyleAction = observer(() => {
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const ReferencesAction = observer(() => {
|
|
|
|
|
|
|
+const LinksAction = observer(() => {
|
|
|
const app = useApp<Shape>()
|
|
const app = useApp<Shape>()
|
|
|
const shape = app.selectedShapesArray[0]
|
|
const shape = app.selectedShapesArray[0]
|
|
|
|
|
|
|
@@ -525,14 +525,14 @@ const ReferencesAction = observer(() => {
|
|
|
className="px-2 tl-button"
|
|
className="px-2 tl-button"
|
|
|
pressed={show}
|
|
pressed={show}
|
|
|
onPressedChange={s => setShow(s)}
|
|
onPressedChange={s => setShow(s)}
|
|
|
- title="Open References and Links"
|
|
|
|
|
|
|
+ title="Open References & Links"
|
|
|
>
|
|
>
|
|
|
<TablerIcon name="link" />
|
|
<TablerIcon name="link" />
|
|
|
- {hasLinks && <div className="tl-shape-references-count">{shape.props.refs?.length}</div>}
|
|
|
|
|
|
|
+ {hasLinks && <div className="tl-shape-links-count">{shape.props.refs?.length}</div>}
|
|
|
</ToggleInput>
|
|
</ToggleInput>
|
|
|
|
|
|
|
|
{show && (
|
|
{show && (
|
|
|
- <div className="tl-shape-references-panel">
|
|
|
|
|
|
|
+ <div className="tl-shape-links-panel">
|
|
|
<TextInput
|
|
<TextInput
|
|
|
title="Website Url"
|
|
title="Website Url"
|
|
|
className="tl-iframe-src"
|
|
className="tl-iframe-src"
|
|
@@ -553,7 +553,7 @@ const ReferencesAction = observer(() => {
|
|
|
</div>
|
|
</div>
|
|
|
{shape.props.refs?.map((ref, i) => {
|
|
{shape.props.refs?.map((ref, i) => {
|
|
|
return (
|
|
return (
|
|
|
- <div className="tl-shape-references-panel-item">
|
|
|
|
|
|
|
+ <div className="tl-shape-links-panel-item">
|
|
|
<div>{ref}</div>
|
|
<div>{ref}</div>
|
|
|
<div className="flex-1" />
|
|
<div className="flex-1" />
|
|
|
<Button
|
|
<Button
|
|
@@ -593,7 +593,7 @@ contextBarActionMapping.set('Swatch', SwatchAction)
|
|
|
contextBarActionMapping.set('StrokeType', StrokeTypeAction)
|
|
contextBarActionMapping.set('StrokeType', StrokeTypeAction)
|
|
|
contextBarActionMapping.set('ArrowMode', ArrowModeAction)
|
|
contextBarActionMapping.set('ArrowMode', ArrowModeAction)
|
|
|
contextBarActionMapping.set('TextStyle', TextStyleAction)
|
|
contextBarActionMapping.set('TextStyle', TextStyleAction)
|
|
|
-contextBarActionMapping.set('References', ReferencesAction)
|
|
|
|
|
|
|
+contextBarActionMapping.set('Links', LinksAction)
|
|
|
|
|
|
|
|
const getContextBarActionTypes = (type: ShapeType) => {
|
|
const getContextBarActionTypes = (type: ShapeType) => {
|
|
|
return (shapeMapping[type] ?? []).filter(isNonNullable)
|
|
return (shapeMapping[type] ?? []).filter(isNonNullable)
|