From a9efa78941d2e41282bfafda1286bdf6eb1ab5fb Mon Sep 17 00:00:00 2001 From: Pratham Gandhi Date: Sat, 11 May 2024 09:57:49 +0530 Subject: [PATCH] implemented AFMergeChange --- core/script/builtin.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/script/builtin.js b/core/script/builtin.js index 877e87b10..61b9d1fa5 100644 --- a/core/script/builtin.js +++ b/core/script/builtin.js @@ -19,6 +19,19 @@ /* Builtin functions for Okular's PDF JavaScript interpretation. */ +/** + * Merge the last change (of a text field) with the uncommitted change + */ +function AFMergeChange( event ) +{ + var start, end; + if ( event.willCommit ) return event.value; + start = (event.selStart >= 0) ? event.value.substring(0, event.selStart) : ""; + end = (event.selEnd >= 0 && event.selEnd <= event.value.length) ? event.value.substring(event.selEnd, event.value.length) : ""; + return start + event.change + end; +} + + /** AFSimple_Calculate * * cFunction is a string that identifies the operation.