The Filerobot Image Editor tools are facing compatibility issues with Bootstrap navigation bars, tabs, and modals

Check out the documentation provided here: https://github.com/scaleflex/filerobot-image-editor

I have integrated Filerobot Image Editor into my project successfully. However, I encountered an issue where the cropping functionality works fine when triggered by a tab click, but features like contrast, brightness, and other editing functionalities do not work within the dashboard UI.

Working editor (top) vs. non-working editor (bottom): https://i.sstatic.net/CUao6i7r.png

You can find the Bootstrap component for the tabs at this link: https://getbootstrap.com/docs/4.0/components/navs/#javascript-behavior

Below is the code snippet of my component:

<nav>
   <div class="nav nav-tabs" id="nav-tab" role="tablist">
        <a 
          class="nav-item nav-link active"
          id="text-editor-tab" data-toggle="tab" 
          href="#text-editor" 
           role="tab" 
           aria- controls="text-editor" 
            aria-selected="true"
           >
              Text Editor
           </a>
          <a 
            class="nav-item nav-link" 
              id="edit-photo-tab" 
               data-toggle="tab" 
               href="#edit-photo" 
              role="tab" 
               aria-controls="edit-photo"
               aria-selected="false"
             >
               Edit Photo
           </a>
            <a 
             class="nav-item nav-link"
             id="advanced-info-tab" 
              data-toggle="tab" 
             href="#advanced-info" 
             role="tab"
             aria-controls="advanced-info" 
                aria-selected="false"
               >
                 Advanced Info
            </a>
       <a 
            class="nav-item nav-link" 
              id="image-info-tab" 
             data-toggle="tab" 
           href="#image-info" 
            role="tab" 
             aria-controls="image-info" 
              aria-selected="false"
               >
                 Image Info
             </a>

      </div>
</nav>

<div class="tab-content" id="nav-tabContent">
  <div class="tab-pane fade show active" id="text-editor" role="tabpanel" aria-labelledby="text-editor-tab">
       <textarea class="ckeditor" style="width:99%;" id="editor1" name="content"></textarea>
  </div>
  <div class="tab-pane fade" id="edit-photo" role="tabpanel" aria-labelledby="edit-photo-tab">
    <div id="image-editor" ></div>
  </div>
  <div class="tab-pane fade" id="advanced-info" role="tabpanel" aria-labelledby="advanced-info-tab">advanced info</div>
    <div class="tab-pane fade" id="image-info" role="tabpanel" aria-labelledby="image-info-tab">image info</div>

</div>
<script src="https://scaleflex.cloudimg.io/v7/plugins/filerobot-image-editor/latest/filerobot-image-editor.min.js?func=proxy"></script>
<script src="../RFAssets/js/edit-image.js" ></script>
<script src="/RFassets/js/ckeditor.js"></script>

And here's the content of my JavaScript file:

window.onload = function() {


  const imageSrc = document.getElementById('rfzone-001').src;
console.log("imageSrc",imageSrc)
const container = document.getElementById("image-editor");

const config = {
  source: imageSrc
};
const ImageEditor = new window.FilerobotImageEditor(container, config);

ImageEditor.render({
  // additional config provided while rendering
  observePluginContainerSize: true,
  onBeforeSave: () => {
    
    return false;
  },
  onSave: (imageInfo, designState) => {
    console.log("yeah", imageInfo,designState)
  
  }
});
}

Answer №1

The root cause of the issue was traced back to the bootstrap navigation elements hiding the editor's wrapper by setting its display property to none. This caused the dimensions of the wrapper to shrink to 0 width and height, subsequently affecting the editor's canvas which mimics the wrapper's size. As a result, the draw process was disrupted.

To address this issue, we have resolved it on our end by ensuring that the canvas dimensions are not set to 0 when the wrapper's dimensions are also 0. However, the fix has not yet been released.

As a temporary workaround from your side, you may consider using visibility: hidden instead of display: none, if feasible. Alternatively, you could implement a workaround such as setting position: absolute; left: -9999px; etc., instead of using display: none.

If you have any further questions or concerns, please feel free to reach out to me.

Sincerely, Emil at Scaleflex

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to patiently wait for a promise to fulfill, retrieve its value, and pass it to another function?

I am facing an issue with getting the value of stringReply into my app.post method in Express. From what I understand, it seems like the code is fully executed before the promise is resolved, resulting in an undefined value when attempting to log stringR ...

Tips for creating a dynamic curved SVG path

I'm looking to draw a black border only along the inside of this SVG. I've tried adding stroke and setting the stroke-width, but that applies the border to the entire SVG. Is there a way to limit the stroke to a certain point within the SVG? d ...

Having trouble with Django's submit POST method for creating objects

Latest Updates: I have successfully implemented a feature where the page does not reload upon clicking the submit button. To achieve this, I filled out the form and inspected the page source code. The form structure was as follows: https://i.sstatic.net/ ...

Having trouble making axios a global instance in my Vue project

Previously, I used to import axios in each Vue component separately when making HTTP requests. An example of this can be seen below: <script lang="ts"> import axios from 'axios'; @Component export default class ExamplePage extend ...

Tips for utilizing the form.checkValidity() method in HTML:

While delving into the source code of a website utilizing MVC architecture, I encountered some difficulties comprehending it fully. Here is a snippet of the view's code: function submitForm (action) { var forms = document.getElementById('form& ...

How can I display information stored in a MySQL database using an HTML Table?

Currently, I am working on a project and could really use some guidance. I possess knowledge of how to implement the functionality in PHP for a MySQL database that stores events. However, I find myself struggling with certain specifics. Given that the pr ...

The response from the ajax call is still pending

I am currently working on integrating MySQL data (select query) using Spring and MyBatis. I have a controller function that is called via ajax in JavaScript to retrieve the database data. For example: ajax url: /testmysql controller requestmapp ...

What is the best way to eliminate a comma from a string if there is no value present?

When the properties are empty in the output, I notice a double comma (,,) in the middle and at the end of the string due to being separated by commas. How can I remove this so that there is only a single comma even when keys are empty? Expected Output: Au ...

Issues with displaying AJAX Bootstrap Modals

I'm struggling to display a Bootstrap modal with dynamically generated content from the database. The data is not showing up in the modal body, and I've been troubleshooting this issue for quite some time now. Modal <div class="modal fade" i ...

Integrating MongoDB data values with Node.js for enhanced functionality

Hey everyone, I'm looking to add two field values {type:Number} from a MongoDB collection using node js and then store the result back in the same collection. To achieve this, I have outlined the steps below: Retrieve the data value from MongoDB wit ...

The use of async components in Vue.js with named imports

I understand how to dynamically load components asynchronously in Vue. For example, instead of importing MyComponent directly: import MyComponent from '@/components/MyComponent' export default { components: { MyComponent } } We can use ...

Sending Data from Dialog Box1 to Dialog Box2 in ASP.NET Using JavaScript

Is there a way to successfully transfer a value from Modal1 to Modal2? I am facing an issue where Modal1 opens Modal2 to receive a necessary value, but I keep encountering the error message: "Uncaught TypeError: Cannot read property 'click' of nu ...

What makes anonymous functions a must-have in AngularJS development?

Many tutorials on AngularJS recommend using anonymous functions instead of normal functions, like function name(para1) {}. For example, take a look at this link: http://www.w3schools.com/angular/tryit.asp?filename=try_ng_controller_property I tried changi ...

Is it better to use regexp.test or string.replace first in my code?

When looking to replace certain parts of a string, is it better to use the replace method directly or first check if there is a match and then perform the replacement? var r1 = /"\+((:?[\w\.]+)(:?(:?\()(:?.*?)(:?\))|$){0,1})\ ...

What is the process for requesting additional GET methods following Express static fetch?

I am in the process of creating my server and client using node express. My goal is to have my HTML file load first (which is automatically handled by express static) followed by the JSON file so that the JSON data can be properly displayed on the HTML fi ...

Limit dependency injection to dependencies within the module

Summary: Is it possible to limit Angular JS dependency injection to components that are only within a module? I recently took over an Angular JS codebase that is quite disorganized, resembling what some would call "spaghetti code." Furthermore, most of t ...

Guide to creating fog animations in three.js

I'm attempting to adjust the fog density using tweening, but for some reason, it doesn't seem to be working. Here are my default settings: var camera, densityFog, colorFog2; colorFog2 = 0xfee2ed; densityFog ...

Tips for creating a state change function using TypeScript

Imagine the temperature remains constant for 20 minutes, but at the 21st minute, it changes. The state change is determined by a programmable state change function. How can I create a function to calculate the difference in state change? if(data.i ...

Dealing with authentication problems when making jQuery AJAX requests

I have set up jQuery ajax calls to the server every 10 seconds on my webpage. However, I also want users to be automatically logged out if they remain idle for 2 minutes without making any requests. I have implemented form authentication cookies with a t ...

JavaScript encountered an error stating "phone is not defined" due to an uncaught ReferenceError

Whenever I click on the Phone Number, it displays an error message saying that the function is not defined. How can I fix this issue? Thank you in advance! Here's the code snippet: <div class="product-label"> <h4><?php echo $p["Fu ...