notion-repackaged: Can't type colon ":" and forward slash "/"
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 <kbd>CTRL + C</kbd>/<kbd>CTRL + V</kbd>. 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!) - https://github.com/notion-enhancer/notion-repackaged/issues/112#issuecomment-1655410475.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 13
- Comments: 41 (4 by maintainers)
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
In the developer console i discovered the js file path
In my pc the folder was
Made a backup
Extracted the content with asar
Inject the js script into the renderer/preload.js file Then repack the app folder with 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
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.
Paste in the console the following function (Found here):
This helped me a lot, but I had to add the semicolon explained here: https://github.com/notion-enhancer/notion-repackaged/issues/116#issuecomment-1866689019
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:
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/.
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:
Similiar error is printed when typing ‘:’ occurs. Using the web app instead seems to work flawlessly.
@hanshou101 Thanks! Couldn’t have done it without your previous discoveries, thank you so much for your contribution
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.
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 <kbd>Ctrl + /</kbd> (or <kbd>⌘ + /</kbd> on macOS) to trigger the slash menu. Alternatively, you can follow @dario-99’s instructions below to manually polyfill the
Array.atmethod in the Notion 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):
npx @electron/asar extract "%localappdata%\Programs\Notion Enhanced\resources\app.asar" "%localappdata%\Programs\Notion Enhanced\resources\app"and hit enter%localappdata%\Programs\Notion Enhanced\resources\and hit enterapp.asartoapp.asar.bakpreload.js(it’s somewhere in the subfolders) and open it(function __polyfill_2() {) at the end ofpreload.jsand save@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.
See https://github.com/notion-enhancer/notion-repackaged/issues/116#issuecomment-1783275997
I wrote an automated patcher for Linux.
👋 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.
Thanks @dario-99 😉 it worked!
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】.
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.
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.
@BrasileroPeDuro At the end of the file will be fine, let me now if it worked.
That’s another +1 for the @dario-99 answer! Thanks a ton!
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:
cd ..twice and it’s fine)npx @electron/asar extract "/Applications/Notion Enhanced.app/Contents/resources/app.asar" "/Applications/Notion Enhanced.app/Contents/resources/app"Workaround works on MacOS as well.
Thanks @dario-99 and @hanshou101 for your contributions.
@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!