Skip to content

IT: How to control the doc's scale by code but not UI #928

@LZpenguin

Description

@LZpenguin

Type

  • Bug

Description

useEffect(() => {
const superdoc = new SuperDoc({
selector: "#document",
toolbar: "#toolbar",
documentMode: "editing",
pagination: true,
rulers: true,
});

const handleWheel = (event) => {
  if (event.ctrlKey) {
    event.preventDefault();

    if (event.deltaY > 0) {
      console.log("down");
      console.log(superdoc.activeEditor.options);
      superdoc.activeEditor.setOptions({
        scale: 2,
      });
    } else {
      console.log("up");
    }
  }
};

window.addEventListener("wheel", handleWheel, { passive: false });
return () => {
  window.removeEventListener("wheel", handleWheel);
};

}, []);

Current Behavior

I tried using setOptions to control the scale but it doesn't work, and i can't find any relative method in official document...

Expected Behavior

Control the doc's scale by code

Steps to Reproduce

None

SuperDoc Version

0.17.0

Browser & Version

Chrome

OS

Windows 11

Additional Context

No response

Checklist

  • Tested with latest version
  • Checked for duplicates
  • Added relevant labels

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions