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

OC.addStyle is not a function #848

Open
gumaerc opened this issue Jul 9, 2024 · 1 comment
Open

OC.addStyle is not a function #848

gumaerc opened this issue Jul 9, 2024 · 1 comment

Comments

@gumaerc
Copy link

gumaerc commented Jul 9, 2024

I recently got full text search up and running on my Nextcloud instance. It works well, except for the fact that I can't really read the search results well at all because it's black text on a dark gray background. It appears as if the code is attempting to apply a stylesheet, but using the deprecated OC.addStyle function to do so. This is the stack trace:

Content-Security-Policy: Ignoring “blob: within script-src-elem: ‘strict-dynamic’ specified fulltextsearch
Unified search initialized! UnifiedSearch.vue:54
Initializing unified search plugin-filters from talk search.js:41:10
session heartbeat polling started session-heartbeat.js:103:9
Registering notifications container as a menu NotificationsApp.vue:237
Notifications permissions not yet requested NotificationsApp.vue:497
Polling interval updated to 30000 NotificationsApp.vue:443
Started background fetcher as session_keepalive is enabled NotificationsApp.vue:293
Search providers 
Array(13) [ {}, {}, {}, {}, {}, {}, {}, {}, {}, {},  ]
UnifiedSearchModal.vue:275
Contacts 
Array(11) [ {}, {}, {}, {}, {}, {}, {}, {}, {}, {},  ]
UnifiedSearchModal.vue:279
[DEBUG] core: this browser is officially supported ! 🚀 
Object { app: "core", uid: "c4103", level: 0 }
ConsoleLogger.js:65:18
Got notification data, restoring default polling interval. NotificationsApp.vue:399
OC
Object { coreApps: Getter & Setter, menuSpeed: Getter & Setter, PERMISSION_ALL: Getter & Setter, PERMISSION_CREATE: Getter & Setter, PERMISSION_DELETE: Getter & Setter, PERMISSION_NONE: Getter & Setter, PERMISSION_READ: Getter & Setter, PERMISSION_SHARE: Getter & Setter, PERMISSION_UPDATE: Getter & Setter, TAG_FAVORITE: Getter & Setter,}

OC.theme
Object { entity: Getter & Setter, name: Getter & Setter, productName: Getter & Setter, title: Getter & Setter, baseUrl: Getter & Setter, syncClientUrl: Getter & Setter, docBaseUrl: Getter & Setter, docPlaceholderUrl: Getter & Setter, slogan: Getter & Setter, logoClaim: Getter & Setter,}

Uncaught TypeError: OC.addStyle is not a function
    displayPanels navigate.js:128
    initPanels navigate.js:110
    jQuery 6
    initPanels navigate.js:106
    init navigate.js:82
    Navigate navigate.js:42
    <anonymous> navigate.js:511
    jQuery 12
    Webpack 7
navigate.js:128:8

I'm running Nextcloud Hub 8 (29.0.3). I don't think any other info is necessary here. OC.addStyle should be replaced with OCP.Loader.loadStylesheet.

@gumaerc
Copy link
Author

gumaerc commented Jul 9, 2024

I was able to modify the app on my instance to get the desired effect. I got it to load the stylesheet without error by simply replacing OC.addStyle with OCP.Loader.loadStylesheet like I mentioned above, but I also had to go into the CSS and set .result_title to color: #FFF because of the dark gray background. I checked and I don't believe I have any custom CSS / theming going on otherwise. I'm using the system default theme but prefer dark mode in general.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant