fix: Update positionForm to support new StyleAwareEditor class names
- Fix TypeError when accessing form.style by adding fallback selectors - Support both legacy (.insertr-edit-form) and new editor class names - Add null checks to prevent crashes when form element is not found - Ensure ensureModalVisible works with all editor types Resolves positioning error when opening style-aware editor interface.
This commit is contained in:
@@ -373,7 +373,16 @@ export class Editor {
|
|||||||
*/
|
*/
|
||||||
positionForm(element, overlay) {
|
positionForm(element, overlay) {
|
||||||
const rect = element.getBoundingClientRect();
|
const rect = element.getBoundingClientRect();
|
||||||
const form = overlay.querySelector('.insertr-edit-form');
|
// Support both old and new editor formats
|
||||||
|
const form = overlay.querySelector('.insertr-edit-form') ||
|
||||||
|
overlay.querySelector('.insertr-style-aware-editor') ||
|
||||||
|
overlay.querySelector('.insertr-fallback-editor');
|
||||||
|
|
||||||
|
if (!form) {
|
||||||
|
console.error('No form element found in overlay for positioning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const viewportWidth = window.innerWidth;
|
const viewportWidth = window.innerWidth;
|
||||||
|
|
||||||
// Calculate optimal width
|
// Calculate optimal width
|
||||||
@@ -409,7 +418,16 @@ export class Editor {
|
|||||||
*/
|
*/
|
||||||
ensureModalVisible(overlay) {
|
ensureModalVisible(overlay) {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
const modal = overlay.querySelector('.insertr-edit-form');
|
// Support both old and new editor formats
|
||||||
|
const modal = overlay.querySelector('.insertr-edit-form') ||
|
||||||
|
overlay.querySelector('.insertr-style-aware-editor') ||
|
||||||
|
overlay.querySelector('.insertr-fallback-editor');
|
||||||
|
|
||||||
|
if (!modal) {
|
||||||
|
console.error('No modal element found for visibility check');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const modalRect = modal.getBoundingClientRect();
|
const modalRect = modal.getBoundingClientRect();
|
||||||
const viewportHeight = window.innerHeight;
|
const viewportHeight = window.innerHeight;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user