Skip to content

Commit

Permalink
qownnotes/web-companion#57 web-companion: allow deleting bookmarks in…
Browse files Browse the repository at this point in the history
… the current note
  • Loading branch information
pbek committed Feb 15, 2024
1 parent f8ef235 commit aa191b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# QOwnNotes Changelog

## 24.2.3
- support was added for the **QOwnNotes Web Companion browser extension**
to also allow deleting of bookmarks in the current note
(for [#57](https://github.com/qownnotes/web-companion/issues/57))
- it was made sure, that the first password field gets the focus in password
dialogs, if the tab order doesn't work properly

Expand Down
14 changes: 14 additions & 0 deletions src/services/websocketserverservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,20 @@ int WebSocketServerService::deleteBookmark(const QJsonObject &jsonObject) {
}
}

// Remove the Markdown text in the current note
MainWindow *mainWindow = MainWindow::instance();
if (mainWindow != nullptr) {
auto textBefore = mainWindow->activeNoteTextEdit()->toPlainText();
auto textAfter = textBefore;
textAfter.remove(markdown + QStringLiteral("\n"));
textAfter.remove(markdown);

if (textBefore != textAfter) {
mainWindow->activeNoteTextEdit()->setPlainText(textAfter);
noteCount++;
}
}

return noteCount;
}

Expand Down

0 comments on commit aa191b5

Please sign in to comment.