Skip to content

Commit

Permalink
fix(markdown): can open URL now
Browse files Browse the repository at this point in the history
  • Loading branch information
thesophiaxu committed Jan 15, 2022
1 parent ff7c1a5 commit 06c701f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,8 @@ export function DetailedNoteBlock({ data, isChildren, callbacks, options, isColl
{!isChildren && !callbacks.isEmbed ? (
<div style={{ marginTop: '4px', marginBottom: '12px', display: 'flex', color: 'gray' }}>
<Icon path={mdiClockOutline} size={0.8} style={{ marginRight: '4px' }} />
{`${new Date(data._updatedAt).toLocaleString()} (${Sugar.Date.relative(
new Date(data._updatedAt),
{`${new Date(data._updatedAt || 0).toLocaleString()} (${Sugar.Date.relative(
new Date(data._updatedAt || 0),
)})`}
</div>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'katex/dist/katex.min.css';
import TurndownService from 'turndown';
import { DynamicViewRenderer } from '../../global.d';
import remarkWikilink from './wikilink';
import { openUrl } from '../../utils';

export function htmlToMarkdown(html: string) {
TurndownService.prototype.escape = (input: string) => input;
Expand Down Expand Up @@ -80,9 +81,9 @@ export const Markdown: DynamicViewRenderer = ({ data, callbacks, isHeading }) =>
compFactory('a', {
...props,
onPointerUp: (ev: any) => {
console.log(ev);
ev.preventDefault();
ev.stopPropagation();
openUrl((props?.node as any)?.properties?.href);
},
target: '_blank',
style: { cursor: 'pointer' },
Expand Down

0 comments on commit 06c701f

Please sign in to comment.