lencx / ChatGPT

🔮 ChatGPT Desktop Application (Mac, Windows and Linux)
https://nofwl.com
52.93k stars 5.96k forks source link

[Bug] Zoom In and Out no longer works. #1254

Open adriandelgg opened 6 months ago

adriandelgg commented 6 months ago

Non-ChatGPT bug

Version

v1.1.0

Bug description

ChatGPT app works fine, but it no longer allows me to Zoom in and out. This is extremely annoying since the text is too small in it's default state.

I've tried removing every single file related to this application and reinstalling both the .deb and AppImage versions, and it still doesn't work. I even tried downloading v1.0.0 and it also doesn't work.

PLEASE FIX

OS

Debian 12

Environment

No response

zeroarst commented 6 months ago

Same here.

einsof-creator commented 6 months ago

I have the same bug, i was wondering if it was only me or the app. Nothing works to zoom in.

adriandelgg commented 6 months ago

Hey @einsof-creator @zeroarst, I actually created a small fix to set the default zoom to any value you want!

Here are the instructions:

  1. Go to "Control Center"
  2. Click on "Scripts"
  3. Edit main.js
  4. Insert this code at the bottom of the main.js file (set the zoom amount to whatever value you want. Note that it has to be enclosed in single '' or double "" quotes). Make sure that it goes inside the last line, so you're going to be replacing the '150%' with a percentage value you want. If you want 150%, leave it as is.:
    
    // zoomAmount must be a string percentage, e.g '150%'
    function setDefaultZoom(zoomAmount) {
    const html = document.getElementsByTagName('html')[0];
    html.style.zoom = zoomAmount;
    window.localStorage.setItem('htmlZoom', zoomAmount);
    }

setDefaultZoom('150%'); // <- Add your zoom amount in this line!


5. Hit save and restart the app.
einsof-creator commented 6 months ago

Awesome, thank you. That worked.

Culpable commented 6 months ago

Potentially related to this bug - my slash commands (/) stopped working altogether.

Previously they would only work on a new chat after I refreshed the app. Now they don't work at all. Anyone have any idea how to fix this?

Norlandz commented 5 months ago

In addition to https://github.com/lencx/ChatGPT/issues/1254#issuecomment-2106324256

I recommend the following, -- to widen the dialog -- remove the "left right padding" to give you more horizontal space.

setDefaultZoom('73%'); // <- Add your zoom amount in this line!

// document.addEventListener('DOMContentLoaded', function () {
setTimeout(function () {

  const style = document.createElement('style');
  // style.innerText = 'div.mx-auto.text-base.md\\:max-w-3xl { max-width: initial !important; }';
  document.head.appendChild(style);
  //   If the sheet property of a newly created style element is null, it's likely because the style element hasn't been added to the document yet.
  style.sheet.insertRule('div.mx-auto.text-base.md\\:max-w-3xl { max-width: initial !important; }', 0);

  // @: idk why need such long time wait, so that this can actualy be inserted // maybe author used .innerHtml to overwrite sth ...
}, 4000);
adriandelgg commented 5 months ago

Nice @Norlandz, that worked! I cleaned it up a bit with this code and it works still:

function expandChatWidth() {
  const styleElement = document.createElement('style');
  styleElement.textContent = `
    div.mx-auto.text-base.md\\:max-w-3xl {
      max-width: initial !important;
      padding: 0 1em;
    }
  `;
  document.head.appendChild(styleElement);
}

expandChatWidth();