question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

responsive not working in react

See original GitHub issue

responsive not working in react .

I created the editor as follows:

import React, { Component, Fragment , createRef} from "react";

// New
import suneditor from 'suneditor'
import plugins from 'suneditor/src/plugins'
import 'suneditor/dist/css/suneditor.min.css'


class Editor extends Component {

    constructor(props) {
        super(props);
        this.state = {
            EditMode : false,
        };
        this.txtArea = createRef();
    }
    
    componentDidMount() {
                //New 
        this.SunEditor =  suneditor.create(this.txtArea.current,{
            buttonList: [
                ['undo', 'redo'],
                ['font', 'fontSize', 'formatBlock', 'align', 'lineHeight'],
                ['bold', 'underline', 'italic', 'strike', 'fontColor', 'hiliteColor'],
                ['removeFormat'],
                ['-right', ':i-More Misc-default.more_vertical', 'showBlocks', 'codeView', 'preview', 'print', 'save'],
                ['-right', ':r-More Rich-default.more_plus', 'horizontalRule', 'list', 'table'],
                ['-right', 'image', 'video', 'audio', 'link'],
                // (min-width: 992)
                ['%1100', [
                    ['undo', 'redo'],
                    ['font', 'fontSize', 'formatBlock', 'align', 'lineHeight'],
                    ['bold', 'underline', 'italic', 'strike', 'fontColor', 'hiliteColor'],
                    ['removeFormat'],
                    ['-right', ':i-More Misc-default.more_vertical', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'fullScreen'],
                    ['-right', ':r-More Rich-default.more_plus', 'image', 'video', 'audio', 'link', 'horizontalRule', 'list', 'table'],
                ]],
                ['%870', [
                    ['undo', 'redo'],
                    ['font', 'fontSize', 'formatBlock', 'align', 'lineHeight'],
                    [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'fontColor', 'hiliteColor'],
                    ['removeFormat'],
                    ['-right', ':i-More Misc-default.more_vertical', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'fullScreen'],
                    ['-right', ':r-More Rich-default.more_plus', 'image', 'video', 'audio', 'link', 'horizontalRule', 'list', 'table'],
                ]],
                ['%660', [
                    ['undo', 'redo'],
                    [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'align', 'lineHeight'],
                    [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'fontColor', 'hiliteColor'],
                    ['removeFormat'],
                    ['-right', ':i-More Misc-default.more_vertical', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'fullScreen'],
                    ['-right', ':r-More Rich-default.more_plus', 'image', 'video', 'audio', 'link', 'horizontalRule', 'list', 'table'],
                ]],
                ['%335', [
                    ['undo', 'redo'],
                    [':p-More Paragraph-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'align', 'lineHeight'],
                    [':t-More Text-default.more_text', 'bold', 'underline', 'italic', 'strike', 'fontColor', 'hiliteColor', 'removeFormat'],
                    ['-right', ':i-More Misc-default.more_vertical', 'showBlocks', 'codeView', 'preview', 'print', 'save', 'fullScreen'],
                    ['-right', ':r-More Rich-default.more_plus', 'image', 'video', 'audio', 'link', 'horizontalRule', 'list', 'table'],
                ]],
            ],
            placeholder: this.props.placeholder ? this.props.placeholder : 'متن را وارد نمایید',
            value :this.props.value,
            plugins: plugins,
            minHeight : 300,
            charCounter: true,
            font: [
                'Vazir', 'Arial', 'Comic Sans MS', 'Courier New', 'Impact',
                'Georgia', 'tahoma', 'Trebuchet MS', 'Verdana'
            ],
        });
        
    }


    render() {
        
        return (
            <Fragment>
                <textarea ref={this.txtArea}></textarea>
            </Fragment>
        );
    }
}

export default Editor;

But the reactionary does not work properly.

But I see this result in the largest size : image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JiHong88commented, Nov 24, 2021

I thought the width would be “100%”… “width” is also available as an option.

suneditor.create("#id", {
 width: "100%"
})
1reaction
Saeeed-Bcommented, Nov 24, 2021

@JiHong88 hi The result of another attempt: I used iframe, but nothing changed. And it did not work as well as before. As before, when the inspector opens, the sizes are correct.

But what do you say about the width of the upper elements, It made me give textarea 100% width and everything was fine. Now the size of the editor is quite correct when loading and is quite responsive.

image

Thank you for your attention to the issues

Read more comments on GitHub >

github_iconTop Results From Across the Web

React not responsive - Stack Overflow
So what I'm trying to do is display both the components when in desktop dimensions and display only the Login component when in...
Read more >
React-responsive not working on first load - Support
Hi there, I have an issue which I assume is something to do with server-side-rendering with JAMstack but I can't work out how...
Read more >
react-responsive - npm
Start using react-responsive in your project by running `npm i react-responsive`. There are 1047 other projects in the npm registry using ...
Read more >
Issues · yocontra/react-responsive - GitHub
CSS media queries in react - for responsive design, and more. - Issues · yocontra/react-responsive.
Read more >
3 Ways To Implement Responsive Design In Your React App
React has truly been a game changer in how we now approach developing ... cons could exacerbate due to higher complexity and lead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found