Skip to content

Commit

Permalink
#79 - Ensure that change event is recorded for contenteditable=true
Browse files Browse the repository at this point in the history
  • Loading branch information
Manvel committed Mar 19, 2021
1 parent e06aa69 commit 4847a43
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/js/cs/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function recordAction(target, actionsData)
function actionRecorder({target, type})
{
const clickActions = [{
queries: ["button", "input[type='button']"],
queries: ["button", "input[type='button'], [contenteditable='true']"],
type: "click",
input1: getPath,
input2: ""
Expand Down Expand Up @@ -82,10 +82,19 @@ function actionRecorder({target, type})
input2: ""
}];

const inputActions = [{
queries: ["[contenteditable='true']"],
type: "change",
input1: getPath,
input2: (closestTarget) => closestTarget.textContent
}];

if (type === "click")
recordAction(target, clickActions);
if(type === "change")
if (type === "change")
recordAction(target, changeActions);
if (type === "input")
recordAction(target, inputActions);
}

/*
Expand Down Expand Up @@ -134,3 +143,4 @@ function sendmsg(type, inputs){

document.addEventListener("click", actionRecorder, true);
document.addEventListener("change", actionRecorder, true);
document.addEventListener("input", actionRecorder, true);

0 comments on commit 4847a43

Please sign in to comment.