Missing if breaking the copy paste functionality

Created on 6 December 2024, 4 months ago

Problem/Motivation

Our copy paste functionality was broken and looking into it I saw there was a console error regarding not being able to find element on event. Based on this i went and looked into it

Steps to reproduce

Click the scissors icon
try and paste it somewhere else
page just refreshed but content doesnt change
check console see following issue

geysir.js?v=1.x:41 Uncaught TypeError: Cannot read properties of null (reading 'element')
    at geysir.js?v=1.x:41:37
    at Function.each (jquery.min.js?v=3.7.1:2:3129)
    at HTMLAnchorElement.<anonymous> (geysir.js?v=1.x:40:15)
    at Function.each (jquery.min.js?v=3.7.1:2:3129)
    at ce.fn.init.each (jquery.min.js?v=3.7.1:2:1594)
    at HTMLDivElement.<anonymous> (geysir.js?v=1.x:36:23)
    at Function.each (jquery.min.js?v=3.7.1:2:3129)
    at ce.fn.init.each (jquery.min.js?v=3.7.1:2:1594)
    at HTMLLIElement.<anonymous> (geysir.js?v=1.x:31:20)
    at HTMLLIElement.dispatch (jquery.min.js?v=3.7.1:2:40035)

Proposed resolution

wrap this in a if

original code

var element = $(event.element);
    if (element.hasClass('geysir-paste')) {
        if (href === event.elementSettings.url) {
           event.options.url = event.options.url.replace('/' + paragraph_id + '/', '/' + parent_id + '/');
       }
    } 

New code

if (event && event.element) {
    var element = $(event.element);
    if (element.hasClass('geysir-paste')) {
        if (href === event.elementSettings.url) {
           event.options.url = event.options.url.replace('/' + paragraph_id + '/', '/' + parent_id + '/');
       }
    } 
}

Remaining tasks

add this into the existing project and create a new fixed version

User interface changes

/

API changes

/

Data model changes

/

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇧🇪Belgium emileg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024