mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 00:46:45 +00:00
fix(note): linkify URLs in locked notes so markdown links stay clickable
After #7004 made isLock actually disable markdown parsing, locked notes showed `[text](url)` as raw text. Pipe the locked-path content through RenderLinksPipe so URLs and markdown links remain clickable without re-enabling full markdown rendering. Fixes #7013
This commit is contained in:
parent
db3bb4016f
commit
8e8a39b832
3 changed files with 63 additions and 3 deletions
57
e2e/tests/notes/note-checklist-link.spec.ts
Normal file
57
e2e/tests/notes/note-checklist-link.spec.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { test, expect } from '../../fixtures/test.fixture';
|
||||
|
||||
test.describe('Issue #7013 — link in checklist in project note', () => {
|
||||
test('unlocked note: link in checklist renders as <a> tag', async ({
|
||||
page,
|
||||
workViewPage,
|
||||
notePage,
|
||||
testPrefix,
|
||||
}) => {
|
||||
await workViewPage.waitForTaskList();
|
||||
|
||||
const unique = `${testPrefix}-7013`;
|
||||
const noteContent = `- [ ] [${unique}-link](https://example.com)`;
|
||||
|
||||
await notePage.addNote(noteContent);
|
||||
|
||||
const note = page.locator('note', { hasText: `${unique}-link` }).first();
|
||||
await expect(note).toBeVisible();
|
||||
|
||||
const anchor = note.locator(`a:has-text("${unique}-link")`);
|
||||
await expect(anchor).toBeVisible();
|
||||
const href = await anchor.getAttribute('href');
|
||||
expect(href).toContain('example.com');
|
||||
});
|
||||
|
||||
test('locked note: link in checklist still renders as <a> tag', async ({
|
||||
page,
|
||||
workViewPage,
|
||||
notePage,
|
||||
testPrefix,
|
||||
}) => {
|
||||
await workViewPage.waitForTaskList();
|
||||
|
||||
const unique = `${testPrefix}-7013-locked`;
|
||||
const noteContent = `- [ ] [${unique}-link](https://example.com)`;
|
||||
|
||||
await notePage.addNote(noteContent);
|
||||
|
||||
const note = page.locator('note', { hasText: `${unique}-link` }).first();
|
||||
await expect(note).toBeVisible();
|
||||
|
||||
// Toggle lock via context menu ("Disable Markdown Parsing")
|
||||
await note.hover();
|
||||
const menuBtn = note.locator('button:has(mat-icon:has-text("more_vert"))');
|
||||
await menuBtn.click();
|
||||
const lockBtn = page
|
||||
.locator('.mat-mdc-menu-content button')
|
||||
.filter({ has: page.locator('mat-icon:has-text("lock_open")') });
|
||||
await lockBtn.click();
|
||||
|
||||
// Locked path should still linkify URLs via RenderLinksPipe
|
||||
const anchor = note.locator(`a:has-text("${unique}-link")`);
|
||||
await expect(anchor).toBeVisible();
|
||||
const href = await anchor.getAttribute('href');
|
||||
expect(href).toContain('example.com');
|
||||
});
|
||||
});
|
||||
|
|
@ -18,9 +18,10 @@
|
|||
<div
|
||||
(click)="editFullscreen($event)"
|
||||
class="markdown-preview"
|
||||
>
|
||||
{{ isLongNote ? resolvedShortenedContent() : resolvedContent() }}
|
||||
</div>
|
||||
[innerHTML]="
|
||||
(isLongNote ? resolvedShortenedContent() : resolvedContent()) | renderLinks
|
||||
"
|
||||
></div>
|
||||
} @else {
|
||||
<div
|
||||
(click)="editFullscreen($event)"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import { AsyncPipe } from '@angular/common';
|
|||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { DEFAULT_PROJECT_COLOR } from '../../work-context/work-context.const';
|
||||
import { ClipboardImageService } from '../../../core/clipboard-image/clipboard-image.service';
|
||||
import { RenderLinksPipe } from '../../../ui/pipes/render-links.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'note',
|
||||
|
|
@ -55,6 +56,7 @@ import { ClipboardImageService } from '../../../core/clipboard-image/clipboard-i
|
|||
MatMenuItem,
|
||||
AsyncPipe,
|
||||
TranslatePipe,
|
||||
RenderLinksPipe,
|
||||
],
|
||||
})
|
||||
export class NoteComponent implements OnChanges {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue