Giter Site home page Giter Site logo

quill-resize-module's People

Contributors

scrapooo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

quill-resize-module's Issues

How to lock the resize ratio?

Hi,
I am not able to find how to lock the resize ratio, meaning that when I am resizing I would like the image not to get distorted :)

Resizing not persisting...

I am trying to same the quill editor content, and I am seeing an issue with resized images when the content is being saved. Here is the payload that I am obtaining from QuillJS.

with Q.getContents()

{
   "ops":[
      {
         "insert":" link, then give the meeting Url to any user you are meeting with. All dashboard widgets are movable and resizable for you to create any layout you desire!\\n\\n"
      },
      {
         "insert":{
            "image":"/10095/file-1681228659469.png"
         }
      },
      {
         "insert":{
            "image":"/10095/file-1681228736323.png"
         }
      },
      {
         "insert":" \\n"
      }
   ]
}

And with Q.root.innerHTML

<p>link, then give the meeting Url to any user you are meeting with. All dashboard widgets are movable and resizable for you to create any layout you desire!</p>
<p><br></p>
<p>
   <img src="/10095/file-1681228659469.png" style="width: 45%; float: right;">
   <img src="/10095/file-1681228736323.png" style="width: 45%; float: left;">
</p>

Please see the image tags in particular. In HTML they have width:45%; float:left;

So, when this content is being loaded into the editor again, the images are not resized!!

使用套件無法修改image size

mycode

我的問題是使用套件後,我去log出content 並沒有發生 width變化

import { Quill } from "react-quill";
import ResizeModule from "@ssumo/quill-resize-module";
Quill.register("modules/resize", ResizeModule);

const APP=()=>{
           const [content,setContent]=React.useState("")
             console.log(content)
          const modules = {
              toolbar: [
                  [{ font: [] }],
                  [{ header: [1, 2, 3, 4, 5, 6, false] }],
                  ["bold", "italic", "underline", "strike"],
                  [{ color: [] }, { background: [] }],
                  [{ script: "sub" }, { script: "super" }],
                  ["blockquote", "code-block"],
                  [{ list: "ordered" }, { list: "bullet" }],
                  [{ indent: "-1" }, { indent: "+1" }, { align: [] }],
                  ["link", "image", "video"],
                  ["clean"],
              ],
              resize: {
                  locale: {
                      // 圖片、影片調整大小以及定位功能
                      altTip: "Hold down the alt key to zoom",
                      floatLeft: "Left",
                      floatRight: "Right",
                      center: "Center",
                      restore: "Restore",
                  },
              },
          }
          
          const formats = [
              "header",
              "bold",
              "italic",
              "underline",
              "strike",
              "blockquote",
              "list",
              "bullet",
              "indent",
              "link",
              "image",
              "imageBlot",
              "imageHandler",
              "alt",
              "width",
              "height",
              "size",
              "align",
              "style",
          ];

               return (<ReactQuill
                        theme="snow"
                        value={content}
                        onChange={setContent}
                        modules={modules}
                        formats={formats}
                        placeholder="這邊寫入內容"
                    />)
}

How to save scaled data?

quill.getContents() doesn't contain image zoom data, which means I can't restore in another place

Cannot be used in React-quill

import React, { useState } from "react";
import ReactQuill, { Quill } from "react-quill";
import "react-quill/dist/quill.snow.css";
// import * as Emoji from "quill-emoji";

import ResizeModule from "@ssumo/quill-resize-module";
Quill.register("modules/resize", ResizeModule);


function App() {
  const [value, setValue] = useState("");
  const toolbarOptions = {
    container: [["bold", "italic", "underline", "strike"], ["emoji"]],
    handlers: { emoji: function() {} },
  };
  
  return (
    <ReactQuill
      theme="snow"
      value={value}
      modules={{
        toolbar: toolbarOptions,
        "emoji-toolbar": true,
        // "emoji-textarea": true,
        "emoji-shortname": true,
        resize: {
          locale: {
            altTip: "按住alt键比例缩放",
            floatLeft: "靠左",
            floatRight: "靠右",
            center: "居中",
            restore: "还原",
          },
        },
      }}
      onChange={setValue}
    />
  );
}

export default App;

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.