Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't type colon ":" and forward slash "/" #112

Open
dolikemedo opened this issue Jul 27, 2023 · 43 comments
Open

Can't type colon ":" and forward slash "/" #112

dolikemedo opened this issue Jul 27, 2023 · 43 comments
Labels
awaiting release This has already been dealt with but is not yet available bug Something isn't working right

Comments

@dolikemedo
Copy link

dolikemedo commented Jul 27, 2023

What is happening?
all of a sudden, no update, no intentional change in host, I can't seem to type colon and backslash.
Every other character works.
Host recognizes the characters.

Operating system/browser name & version:
Ubuntu 22.04 , Asus K6500ZE,
uname -a
Linux BB-8 5.19.17-051917-generic #202210240939 SMP PREEMPT_DYNAMIC Mon Oct 24 09:43:01 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Also tested on a ubuntu 20.04

notion-enhancer and/or notion-repackaged version:

notion-app-enhanced/unknown,now 2.0.18-1 amd64 [installed]

notion-enhancer configuration (enabled/disabled mods and their settings):

I used the default guide here.
I set dark mode.
I disabled spellcheck.

It was working flawlessly, never had an issue with it.
tried so far:

  • copy & paste colon or blackslash works.
  • reinstalling didn't help. Same happens with notion-app-enhanced and notion-app.
  • log in and out.
  • change keyboard layout
  • Try external keyboard

I'll try rolling back
Thanks for any help!

Edit by @dragonwocky: This also appears to affect copying/pasting with CTRL + C/CTRL + V. Notion is using the Array.at() method which is a newer JavaScript feature that isn't present in the current distribution of notion-repackaged. @dario-99 has detailed how to add a polyfill to the app to fix this below (thanks!) - #112 (comment).

@dolikemedo dolikemedo added the bug Something isn't working right label Jul 27, 2023
@dario-99
Copy link

It happens also with my arch installation, both with Notion-app and notion-app-enhanced from the AUR.
When typing '/' the developer console prints this error:

app-f1468bbbf91e50c2009a.js:1 Uncaught TypeError: y.at is not a function
    at Object.b (app-f1468bbbf91e50c2009a.js:1)
    at ge (app-f1468bbbf91e50c2009a.js:1)
    at Pe (app-f1468bbbf91e50c2009a.js:1)
    at Object.Te (app-f1468bbbf91e50c2009a.js:1)
    at perform (app-f1468bbbf91e50c2009a.js:1)
    at app-f1468bbbf91e50c2009a.js:1
    at Function.withListenerIgnored (app-f1468bbbf91e50c2009a.js:1)
    at Module.ve (app-f1468bbbf91e50c2009a.js:1)
    at pe.handleMutation (app-f1468bbbf91e50c2009a.js:1)
    at b.handleMutation (app-f1468bbbf91e50c2009a.js:1)
    at b.delegateMutation (app-f1468bbbf91e50c2009a.js:1)
    at app-f1468bbbf91e50c2009a.js:1
    at app-f1468bbbf91e50c2009a.js:1
    at Set.forEach (<anonymous>)
    at B.emitUpdate (app-f1468bbbf91e50c2009a.js:1)
    at B.handleMutations (app-f1468bbbf91e50c2009a.js:1)
    at g.onMutations (app-f1468bbbf91e50c2009a.js:1)
    at g.stopObservingAndHandleMutations (app-f1468bbbf91e50c2009a.js:1)
    at MutationObserver.observer (app-f1468bbbf91e50c2009a.js:1)

Similiar error is printed when typing ':' occurs.
Using the web app instead seems to work flawlessly.

@ChinaNuke
Copy link

Same problem on my ArchLinux. Unable to type / and :. When I'm typing the two keys they behave like the right arrow, just moving the cursor forward.
I'm using notion-app 2.0.18-1.

@dragonwocky
Copy link
Member

dragonwocky commented Jul 28, 2023

It's a bug related to the desktop app not being updated for a while, rather than something specifically caused by the notion-enhancer (which is why it doesn't happen when using the notion-enhancer as a browser extension). Thanks for reporting it here.

There's no simple fix-all yet, but as a partial workaround: you can use Ctrl + / (or ⌘ + / on macOS) to trigger the slash menu. Alternatively, you can follow @dario-99's instructions below to manually polyfill the Array.at method in the Notion app.

@hanshou101
Copy link

hanshou101 commented Jul 28, 2023

After my personal experimentation, I found out that the 【 Array.at() 】 API is available in the latest version of the 【Chrome browser】; but it is not supported by the 【Chromium】 engine that comes with 【Electron】.

That is, the 【Chromium】 engine of 【Notion】's 【Electron】 currently uses an older JS version; it cannot recognize the new version of the API syntax of the 【js file】 distributed by 【Notion】.

@hanshou101
Copy link

From my point of view, based on my existing front-end knowledge, I would try to make a temporary fix like this (to get myself back to work quickly).

1. Upgrade the 【Chromium】 version used by 【Electron Application】, and then repackage an 【Electron Application】.

But the problem I encountered is that I don't have the source code to build, so I can't complete the repackaging by replacing the 【electron version】 in 【package.json】.

2. By loading a 【polyfill.js】 script before 【app-[hash].js】 of 【Notion】 is loaded, the compatibility support for 【Array.at()】 syntax is completed.

So that this exception error can be bypassed very well. (Or, I can write a 【Array.prototype.at = function(idx){ ... }】 by myself; it is not a complicated thing)

The problem I encountered here is that I don't have a good means of inserting when 【html is loaded】. If it is in the Chrome browser, I can use 【TamperMonkey】 or other plug-ins, or even write a 【DevTools - Sources - Overrides】 to achieve it.

But in 【Electron】, there is no support for 【extended plug-ins】; moreover, I cannot see the existence of 【app-[hash].js】 in 【DevTools —— Sources】. (It was placed in 【DevTools —— Application —— Scripts】??? Is it just me?)

3.There are some other alternatives, such as using 【BurpSuite】 for network capture, and inserting the loading <script> of 【polyfill.js】 when 【html】 of 【Notion】 is loaded.

But that seems a bit too much trouble—I need to keep 【BurpSuite】 open all the time.


To sum up, here are some of my current discoveries and attempts.

@dario-99
Copy link

Searching the web i found a partial solution by imlementing manually the .at function:
Press alt and in the View menu open the developer console.
Screenshot_20230728_115105
Paste in the console the following function (Found here):

function at(n) {
    // ToInteger() abstract op
    n = Math.trunc(n) || 0;
    // Allow negative indexing from the end
    if (n < 0) n += this.length;
    // OOB access is guaranteed to return undefined
    if (n < 0 || n >= this.length) return undefined;
    // Otherwise, this is just normal property access
    return this[n];
}

const TypedArray = Reflect.getPrototypeOf(Int8Array);
for (const C of [Array, String, TypedArray]) {
    Object.defineProperty(C.prototype, "at",
                          { value: at,
                            writable: true,
                            enumerable: false,
                            configurable: true });
}

Screenshot_20230728_115149
As you can see the / menu works, also it types ':' correctly now.
Screenshot_20230728_115235
Hope it helps.

@dario-99
Copy link

Actually found a way to inject the js function by injecting the script in the .asar file of Notion.
First i installed asar from my package manager to handle the archived js files

sudo pacman -S asar

In the developer console i discovered the js file path
Screenshot_20230728_122031
In my pc the folder was

/opt/Notion/resources/app.asar

Made a backup

sudo cp app.asar app.asar.bak

Extracted the content with asar

sudo asar extract app.asar app
cd ./app

Inject the js script into the renderer/preload.js file
Then repack the app folder with asar

sudo asar pack ./app app.asar

and it should work! I choose preload.js randomly i think any js file in the source tab of the developer console should work.
Not a js developer by any means, just went with common sense, if i made any mistake let me now

@Kaspary
Copy link

Kaspary commented Jul 28, 2023

The @dario-99 answer works for me!

I'm currently using Pop OS 22.04 (Ubuntu). To install the asar package, I use NPM with the following command:

npm install -g asar

Once it's installed, I proceed to unpack and pack the app.asar file. I prefer moving the app.asar to my user workspace, avoiding the need to configure my root user. After packing, I return the app.asar to notion path - /opt/Notion/resources/.

@hanshou101
Copy link

hanshou101 commented Jul 28, 2023

Inject the js script into the renderer/preload.js file Then repack the app folder with asar

sudo asar pack ./app app.asar

and it should work! I choose preload.js randomly i think any js file in the source tab of the developer console should work. Not a js developer by any means, just went with common sense, if i made any mistake let me now

@dario-99

Awesome Solution !

Brother, you accomplished what I always wanted to do. I have read a lot of Electron reverse analysis articles before, but I ignored 【the key details that are correctly used by you now】! Your solution filled my dead end and inspired me too!

@dario-99
Copy link

@hanshou101 Thanks!
Couldn't have done it without your previous discoveries, thank you so much for your contribution

@supermavster
Copy link

Thanks @dario-99 ;) it worked!

@archetyped
Copy link

Workaround works on MacOS as well.

Thanks @dario-99 and @hanshou101 for your contributions.

@dolikemedo
Copy link
Author

Thank you very much @dario-99 , @hanshou101 !! :-)

@liqnuks
Copy link

liqnuks commented Jul 31, 2023

Thanks a lot @dario-99 and @hanshou101 ! That's awesome.

@dario-99
Copy link

dario-99 commented Jul 31, 2023

@giorgioindelicato11 Look here
Maybe you can extract the content of the appimage, modify the js file and rebuild the appimage with the appimagetool.
There's also this thread on superuser which may help you.
Let us know if you found a solution, it may be useful to other appimage user

@RHeinig
Copy link

RHeinig commented Aug 2, 2023

Actually found a way to inject the js function by injecting the script in the .asar file of Notion. First i installed asar from my package manager to handle the archived js files

sudo pacman -S asar

In the developer console i discovered the js file path Screenshot_20230728_122031 In my pc the folder was

/opt/Notion/resources/app.asar

Made a backup

sudo cp app.asar app.asar.bak

Extracted the content with asar

sudo asar extract app.asar app
cd ./app

Inject the js script into the renderer/preload.js file Then repack the app folder with asar

sudo asar pack ./app app.asar

and it should work! I choose preload.js randomly i think any js file in the source tab of the developer console should work. Not a js developer by any means, just went with common sense, if i made any mistake let me now

As a macOS noobie, I got it to work with a few tweaks, I'll write those down for docs when someone as noobie with mac as me stumbles upon this:

  1. Make sure you are opening the terminal at the base layer (for me it opens at Users/myname, it should be at the base of your mac, basically do cd .. twice and it's fine)
  2. My command was with file extensions + Contents app, and looked like this:
    npx @electron/asar extract "/Applications/Notion Enhanced.app/Contents/resources/app.asar" "/Applications/Notion Enhanced.app/Contents/resources/app"

@orribu
Copy link

orribu commented Aug 4, 2023

That's another +1 for the @dario-99 answer! Thanks a ton!

@BrasileroPeDuro
Copy link

Actually found a way to inject the js function by injecting the script in the .asar file of Notion. First i installed asar from my package manager to handle the archived js files

sudo pacman -S asar

In the developer console i discovered the js file path Screenshot_20230728_122031 In my pc the folder was

/opt/Notion/resources/app.asar

Made a backup

sudo cp app.asar app.asar.bak

Extracted the content with asar

sudo asar extract app.asar app
cd ./app

Inject the js script into the renderer/preload.js file Then repack the app folder with asar

sudo asar pack ./app app.asar

and it should work! I choose preload.js randomly i think any js file in the source tab of the developer console should work. Not a js developer by any means, just went with common sense, if i made any mistake let me now

First of all, thanks @dario-99 for the answer! However, I'm struggling to understand how exactly do I "inject the js script into the renderer/preload.js". I've tried to paste the code into the file with a text editor, but I don't know exactly where to place it. Could you/someone explain me how to proceed and help a n00b? :P

@dario-99
Copy link

dario-99 commented Aug 6, 2023

First of all, thanks @dario-99 for the answer! However, I'm struggling to understand how exactly do I "inject the js script into the renderer/preload.js". I've tried to paste the code into the file with a text editor, but I don't know exactly where to place it. Could you/someone explain me how to proceed and help a n00b? :P

@BrasileroPeDuro At the end of the file will be fine, let me now if it worked.

@BrasileroPeDuro
Copy link

First of all, thanks @dario-99 for the answer! However, I'm struggling to understand how exactly do I "inject the js script into the renderer/preload.js". I've tried to paste the code into the file with a text editor, but I don't know exactly where to place it. Could you/someone explain me how to proceed and help a n00b? :P

@BrasileroPeDuro At the end of the file will be fine, let me now if it worked.

It worked perfectly! Thanks a lot!!

@adriandelgg
Copy link

Similar issue on my end.
notion-enhancer/notion-enhancer#807

@lietu
Copy link

lietu commented Aug 7, 2023

I also ran into this a while ago on the AUR notion-app-enhanced package. Based on the comments here I found that this fixes it:

sudo pacman -S asar
cd "/opt/Notion Enhanced/resources"
sudo asar extract app.asar app

cd app
echo '"use strict;"' | sudo tee preload.new.js
echo 'function at(n) { n = Math.trunc(n) || 0; if (n < 0) n += this.length; if (n < 0 || n >= this.length) return undefined; return this[n]; }; const TypedArray = Reflect.getPrototypeOf(Int8Array); for (const C of [Array, String, TypedArray]) { Object.defineProperty(C.prototype, "at", {value: at, writable: true, enumerable: false, configurable: true }); }; console.log("Applied .at polyfill")' | sudo tee -a preload.new.js
cat renderer/preload.js | tail -n+2 | sudo tee -a preload.new.js
sudo mv preload.new.js renderer/preload.js
cd ..

sudo rm app.asar
sudo asar pack ./app app.asar
sudo rm -rf app

@AmodeusR
Copy link

AmodeusR commented Aug 9, 2023

Actually found a way to inject the js function by injecting the script in the .asar file of Notion. First i installed asar from my package manager to handle the archived js files

sudo pacman -S asar

In the developer console i discovered the js file path Screenshot_20230728_122031 In my pc the folder was

/opt/Notion/resources/app.asar

Made a backup

sudo cp app.asar app.asar.bak

Extracted the content with asar

sudo asar extract app.asar app
cd ./app

Inject the js script into the renderer/preload.js file Then repack the app folder with asar

sudo asar pack ./app app.asar

and it should work! I choose preload.js randomly i think any js file in the source tab of the developer console should work. Not a js developer by any means, just went with common sense, if i made any mistake let me now

Isn't it possible to share the fixed file? I don't really want to install unnecessary things in my PC.

@dragonwocky dragonwocky added the awaiting release This has already been dealt with but is not yet available label Sep 4, 2023
@kidonng
Copy link

kidonng commented Oct 27, 2023

👋 For anyone on Linux, I have built an updated AppImage repack of Notion: https://github.com/kidonng/notion-appimage

It is inspired by notion-repackaged but with up-to-date Electron that fixes many issues, including this one.

@acerspyro
Copy link

See #116 (comment)

I wrote an automated patcher for Linux.

@tkdemd1234
Copy link

20231030_160723
After unzipping the app.asar file, I found the preload.js file, what should I do here after that?

@dolikemedo
Copy link
Author

@tkdemd1234 Try and inject the function provided by @dario-99 into the end of file

@kotobuki09
Copy link

Thank you for the solution. But this solution somehow breaks all other enhanced features for me. Even the theme is not apply after this fix

@esmewang27
Copy link

esmewang27 commented Nov 3, 2023

2. app.asar

I'm even more of a noob than you are. I'm a Mac OS user & while I was previously been able to fix the : and / problems, the new "window comes up, gray thing spins" problem has been beyond me.

I've been recommended to not try anything with sudo (though I did anyway out of desperation) because I have zero idea how to code.

What I did do was put the following code in the Terminal:

function at(n) {
// ToInteger() abstract op
n = Math.trunc(n) || 0;
// Allow negative indexing from the end
if (n < 0) n += this.length;
// OOB access is guaranteed to return undefined
if (n < 0 || n >= this.length) return undefined;
// Otherwise, this is just normal property access
return this[n];
}

const TypedArray = Reflect.getPrototypeOf(Int8Array);
for (const C of [Array, String, TypedArray]) {
Object.defineProperty(C.prototype, "at",
{ value: at,
writable: true,
enumerable: false,
configurable: true });
}

And then I put the following in the Developer Tools:

npx @electron/asar extract "/Applications/Notion Enhanced.app/Contents/resources/app.asar" "/Applications/Notion Enhanced.app/Contents/resources/app"

All of this, in the end, did not help at all.

At this point, I'm really desperate to have the Notion Enhancer app back--I'm willing to give someone money to explain it to me like I'm a third-grader. And if I just have to give up on it, I guess I'll wait until a more substantial fix comes. I did already spend over three hours on this, to no avail.

@dragonwocky
Copy link
Member

What I did do was put the following code in the Terminal:

And then I put the following in the Developer Tools:

@esmewang27 you've got those the wrong way around, so I'm not surprised things didn't work for you. You shouldn't be running either of those snippets in either of those places. You have two options:

  • For a fix that will only last until you next restart the app, you can paste the code that starts with function at(n) into the Developer Tools - not the Terminal.

  • For a more permanent fix:

    1. Quit the app fully.
    2. Run the command that starts with npx in the Terminal - not the Developer Tools.
    3. Go to the /Applications/Notion Enhanced.app/Contents/resources folder in Finder.
    4. Rename the app.asar file to app.asar.bak.
    5. Go to the /Applications/Notion Enhanced.app/Contents/resources/app/renderer folder in Finder.
    6. Open the preload.js file, go to the end and paste in the code that starts with function at(n) on a new line. Do not delete anything, just add the code to the end of the file and save it.
    7. Now, when you open the app, this particular problem should be fixed.

However, please note that this will not fix the issue described in #116. You can follow the same steps to fix that issue, but the code to paste into the file in step 6 is different. You will probably need to paste the code from both issues into that file for things to start working as normal.

@esmewang27
Copy link

esmewang27 commented Nov 3, 2023

Hi @dragonwocky. I really appreciate your patience with an idiot like me who knows absolutely nothing about this (and greatly appreciates what you've created for us).

This seems to have solved the issue. I am so relieved and grateful—is there some kind of tip jar that you have that I can contribute to?

@dragonwocky
Copy link
Member

This does not seem to have done anything to fix the #116 problem, although I might be doing something else completely stupid, and I truly, truly appreciate your help.

Hmm, can you show me what the output in the Notion DevTools console is?

@esmewang27
Copy link

@dragonwocky Oh, I edited the post because I ended up figuring out the problem myself. And I wanted to thank you! Do you have a tip jar or something I can put money in?

@dragonwocky
Copy link
Member

@esmewang27 glad you got it working! If it was a problem you think others may run into as well, it could be helpful to include your solution in the post for the next person who comes along 🙂

You can donate to me through my GitHub Sponsors profile: https://github.com/sponsors/dragonwocky

@matt-derrick
Copy link

Is this issue ever going to be fixed? This is literally making Notion unusable for me on Windows 10, so now I'm stuck looking for a replacement for this app.

@acerspyro
Copy link

Is this issue ever going to be fixed? This is literally making Notion unusable for me on Windows 10, so now I'm stuck looking for a replacement for this app.

@dragonwocky is currently busy with exams, and is donating their free time to this project whenever the opportunity to do so arises.

If you'd like to help this issue along, please consider a donation to support them, it goes a long way ☺️

https://github.com/sponsors/dragonwocky/

@archetyped
Copy link

Is this issue ever going to be fixed? This is literally making Notion unusable for me on Windows 10, so now I'm stuck looking for a replacement for this app.

@matt-derrick you do realize that this is not the official Notion app, right? It's an unofficial mod that @dragonwocky has shared with the community.

If you're "stuck looking for a replacement", perhaps consider the official desktop app.

@matt-derrick
Copy link

Is this issue ever going to be fixed? This is literally making Notion unusable for me on Windows 10, so now I'm stuck looking for a replacement for this app.

@matt-derrick you do realize that this is not the official Notion app, right? It's an unofficial mod that @dragonwocky has shared with the community.

If you're "stuck looking for a replacement", perhaps consider the official desktop app.

I apologize, I did not realize that. I am using the vanilla version of notion and having this same issue; I came across it in an internet search and should have been paying more attention.

@archetyped
Copy link

I apologize, I did not realize that. I am using the vanilla version of notion and having this same issue; I came across it in an internet search and should have been paying more attention.

If you're using Notion's official app, I'd recommending ensuring that you're using the latest version by uninstalling the current app, downloading the latest build, and reinstall it.

@pinetreemoonlight
Copy link

pinetreemoonlight commented Dec 22, 2023

Is this issue ever going to be fixed? This is literally making Notion unusable for me on Windows 10, so now I'm stuck looking for a replacement for this app.

This is what I did on Windows 11, source is a comment by @dragonwocky on the Discord server (I have no idea if all these steps are necessary, someone please correct me if needed):

  1. Close Notion Enhanced, if needed go to Task Manager and make sure all its processes are closed.
  2. install node.js
  3. open cmd as administrator and paste npx @electron/asar extract "%localappdata%\Programs\Notion Enhanced\resources\app.asar" "%localappdata%\Programs\Notion Enhanced\resources\app" and hit enter
  4. type win+R, paste %localappdata%\Programs\Notion Enhanced\resources\ and hit enter
  5. in that folder, rename app.asar to app.asar.bak
  6. search the same folder for preload.js (it's somewhere in the subfolders) and open it
  7. paste the code from this comment (the one that starts with (function __polyfill_2() {) at the end of preload.js and save
  8. open Notion Enhanced, it should be fixed.

@lhecht
Copy link

lhecht commented Jan 3, 2024

Is this issue ever going to be fixed? This is literally making Notion unusable for me on Windows 10, so now I'm stuck looking for a replacement for this app.

This is what I did on Windows 11, source is a comment by @dragonwocky on the Discord server (I have no idea if all these steps are necessary, someone please correct me if needed):

0. Close Notion Enhanced, if needed go to Task Manager and make sure all its processes are closed.

1. install node.js

2. open cmd as administrator and paste `npx @electron/asar extract "%localappdata%\Programs\Notion Enhanced\resources\app.asar" "%localappdata%\Programs\Notion Enhanced\resources\app"` and hit enter

3. type win+R, paste `%localappdata%\Programs\Notion Enhanced\resources\` and hit enter

4. in that folder, rename `app.asar` to `app.asar.bak`

5. search the same folder for `preload.js` (it's somewhere in the subfolders) and open it

6. paste the code from [this comment](https://github.com/notion-enhancer/notion-repackaged/issues/116#issuecomment-1782243815)  (the one that starts with `(function __polyfill_2() {`) at the end of `preload.js` and save

7. open Notion Enhanced, it should be fixed.

This helped me a lot, but I had to add the semicolon explained here: #116 (comment)

@alexandre-ohayon
Copy link

I also ran into this a while ago on the AUR notion-app-enhanced package. Based on the comments here I found that this fixes it:

sudo pacman -S asar
cd "/opt/Notion Enhanced/resources"
sudo asar extract app.asar app

cd app
echo '"use strict;"' | sudo tee preload.new.js
echo 'function at(n) { n = Math.trunc(n) || 0; if (n < 0) n += this.length; if (n < 0 || n >= this.length) return undefined; return this[n]; }; const TypedArray = Reflect.getPrototypeOf(Int8Array); for (const C of [Array, String, TypedArray]) { Object.defineProperty(C.prototype, "at", {value: at, writable: true, enumerable: false, configurable: true }); }; console.log("Applied .at polyfill")' | sudo tee -a preload.new.js
cat renderer/preload.js | tail -n+2 | sudo tee -a preload.new.js
sudo mv preload.new.js renderer/preload.js
cd ..

sudo rm app.asar
sudo asar pack ./app app.asar
sudo rm -rf app

Thank you for the script.

@FunMelon
Copy link

Is this issue ever going to be fixed? This is literally making Notion unusable for me on Windows 10, so now I'm stuck looking for a replacement for this app.

This is what I did on Windows 11, source is a comment by @dragonwocky on the Discord server (I have no idea if all these steps are necessary, someone please correct me if needed):

0. Close Notion Enhanced, if needed go to Task Manager and make sure all its processes are closed.

1. install node.js

2. open cmd as administrator and paste `npx @electron/asar extract "%localappdata%\Programs\Notion Enhanced\resources\app.asar" "%localappdata%\Programs\Notion Enhanced\resources\app"` and hit enter

3. type win+R, paste `%localappdata%\Programs\Notion Enhanced\resources\` and hit enter

4. in that folder, rename `app.asar` to `app.asar.bak`

5. search the same folder for `preload.js` (it's somewhere in the subfolders) and open it

6. paste the code from [this comment](https://github.com/notion-enhancer/notion-repackaged/issues/116#issuecomment-1782243815)  (the one that starts with `(function __polyfill_2() {`) at the end of `preload.js` and save

7. open Notion Enhanced, it should be fixed.

This helped me a lot, but I had to add the semicolon explained here: #116 (comment)

Thanks for your detailed explanation!
But I met a problem, after I extract the app folder, I find that there are several preload.js files:
image
I try to add the code to every file at their ends but the problem is still unsolved.-

  • Notion: 4.2.0
  • Notion enchanced: 2.0.18-1
    Windows
    Besides, I try to observe the preload.js, I find they are like:
(()=>{"use strict";var e={326:function(e,n,o){var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.broadcast=n.handleMainToRendererEvent=void 0,n.getSimpleEmitter=function(e){return{addListener:o=>n.handleMainToRendererEvent.addListener(e,o),removeListener(o){n.handleMainToRendererEvent.removeListener(e,o)},listeners:()=>n.handleMainToRendererEvent.listeners(e)}},n.invokeInMainAndReturnResult=t,n.invokerInMain=function(e){return(...n)=>t(e,...n)},n.sendToMain=d,n.senderToMain=function(e){return(...n)=>d(e,...n)};const i=a(o(288));n.handleMainToRendererEvent={addListener(e,n){const o=n;return i.default.ipcRenderer.addListener(e,o),()=>i.default.ipcRenderer.removeListener(e,o)},removeListener(e,n){i.default.ipcRenderer.removeListener(e,n)},listeners:e=>i.default.ipcRenderer.listeners(e),once(e,n){i.default.ipcRenderer.once(e,n)}};const r=new Map;function t(e,...n){return i.default.ipcRenderer.invoke(e,...n)}function d(e,...n){i.default.ipcRenderer.send(e,...n)}n.broadcast={emit(e,...n){d("notion:broadcast",{channel:e,args:n})},addListener(e,o){const a=n.handleMainToRendererEvent.addListener("notion:broadcast",((n,a)=>{a.channel===e&&o(...a.args)}));r.set(o,a)},removeListener(e,n){const o=r.get(n);o&&(o(),r.delete(n))}}},793:(e,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.navigationHistory=void 0;const a=o(326);n.navigationHistory={handleBackMetaClick:()=>{(0,a.sendToMain)("notion:navigation-meta-click","back")},handleForwardMetaClick:()=>{(0,a.sendToMain)("notion:navigation-meta-click","forward")},handleBackPinnedClick:()=>{(0,a.sendToMain)("notion:navigation-pinned-click","back")},handleForwardPinnedClick:()=>{(0,a.sendToMain)("notion:navigation-pinned-click","forward")},handleTabHistoryMenu:(0,a.senderToMain)("notion:show-tab-history-menu")}},232:(e,n,o)=>{n.R=void 0;const a=o(288),i=o(326),r=o(793);n.R={tabBarState:(0,i.getSimpleEmitter)("tabs:set-state"),navigationHistory:r.navigationHistory,goBack:(0,i.senderToMain)("notion:go-back"),goForward:(0,i.senderToMain)("notion:go-forward"),newTab:(0,i.senderToMain)("notion:new-tab-from-tab-bar"),toggleSidebarExpansion:(0,i.senderToMain)("notion:toggle-sidebar-expanded"),setSidebarOpen:(0,i.senderToMain)("notion:set-sidebar-open"),toggleMaximized:(0,i.senderToMain)("notion:toggle-maximized"),handleTabClicked:(0,i.senderToMain)("notion:tab-clicked"),handleTabClose:(0,i.senderToMain)("notion:close-tab"),handleTabMenu:(0,i.senderToMain)("notion:show-tab-menu"),handleRendererVisibilityChange:(0,i.senderToMain)("notion:renderer-visibility-changed"),updateTabOrder:(0,i.senderToMain)("notion:set-tab-order"),openApplicationMenu:(0,i.senderToMain)("notion:open-app-menu"),moveTabToNewWindow:(0,i.senderToMain)("notion:move-tab-to-new-window"),insertTabFromExternalWindow:(0,i.senderToMain)("notion:insert-tab-from-external-window"),setDraggedOverWindowId:(0,i.senderToMain)("notion:set-dragged-over-window-id"),clearDraggedOverWindowId:(0,i.senderToMain)("notion:clear-dragged-over-window-id"),setHoveredTab:(0,i.senderToMain)("notion:set-hovered-tab"),clearHoveredTab:(0,i.senderToMain)("notion:clear-hovered-tab")},window.addEventListener("dragstart",(e=>{e.dataTransfer&&(e.dataTransfer.effectAllowed="copyMove")})),window.addEventListener("dragleave",(e=>{e.dataTransfer&&(e.dataTransfer.dropEffect="copy")})),a.contextBridge.exposeInMainWorld("tabsApi",n.R)},288:e=>{e.exports=require("electron")}},n={};function o(a){var i=n[a];if(void 0!==i)return i.exports;var r=n[a]={exports:{}};return e[a].call(r.exports,r,r.exports,o),r.exports}void 0!==o&&(o.ab="/native_modules/"),o(232)})();
//# sourceMappingURL=preload.js.map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting release This has already been dealt with but is not yet available bug Something isn't working right
Projects
None yet
Development

No branches or pull requests