I'm trying to change the behavior of the paste command, I think I found the place where I should do that, however I even added a simple console.log('pasted content')
and it prints nothing, I run the application using
npm run start
from packages/app-desktop
and I figure that the place where I should debug is
joplin/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts at f938d5f4893c54d5fb22efb8959c295da4f9189a · laurent22/joplin · GitHub (lines 194-207). Can someone help me?
paste: {
label: _('Paste'),
onAction: async (options: ContextMenuOptions) => {
const pastedHtml = clipboard.readHTML();
let content = pastedHtml ? pastedHtml : clipboard.readText();
if (pastedHtml) {
content = await processPastedHtml(pastedHtml, htmlToMd, mdToHtml);
}
content = enhancePastedText(content);
console.debug('pasted content');
options.insertContent(content);
},
Have you rebuild the files with yarn watch
or yarn tsc
?
yes and I think it worked because otherwise it wouldn't be inside of the sources in the developer tools?
Is there a generated contextMenu.js
file with you update?
yes, in the (no domain) in the sources in the developer tools I can see it
For me the output appears in the console.
Do you try it for the Rich Text editor
?
packages\app-desktop\gui\NoteEditor\utils\contextMenu.ts
=> Rich Text editor
packages\app-desktop\gui\NoteEditor\NoteBody\CodeMirror\utils\useContextMenu.ts
=> MD editor
I just tried, also doesn't work
Does a code change work at all?
Have you tried with yarn start
as described in the documentation?
As I am not sure whether everything else is taken from the monorepo.
no
yes
I guess it wouldn't work without the shared library? I guess it's lib
.
If code changes generally don't work when compiling, I can't help you any further at the moment.
git clone https://github.com/laurent22/joplin.git
cd joplin
yarn install
yarn watch
The yarn watch
compiles on every file change the TS to JS file.
Change some code, start a new cli
cd joplin/packages/app-desktop
yarn start
If it doesn't work like this, is there something wrong with your system or are you changing the wrong files from a different directory and starting joplin from a different one?