Skip to content

Commit de69859

Browse files
committed
Fix WordCheck JS functions
disableAW needs to be in the global window context for use in the in-page JS code. While we're in here, make all the module exports explicit.
1 parent a8d0e44 commit de69859

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tools/proofers/wordcheck.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* exported acceptWord */
2-
/* exported evaluateWordChange */
3-
/* exported markBox */
4-
/* exported confirmExit */
51
/* global wordCheckMessages */
62

73
import { testText } from "../../scripts/character_test.js";
@@ -67,7 +63,7 @@ function enableAW(wordID) {
6763
}
6864

6965
// Disable a bad word's Unflag button
70-
function disableAW(wordID) {
66+
export function disableAW(wordID) {
7167
var a = document.getElementById("a_" + wordID);
7268

7369
// If the value of the input field hasn't changed, don't disable
@@ -92,12 +88,13 @@ function disableAW(wordID) {
9288

9389
return false;
9490
}
91+
window.disableAW = disableAW;
9592

9693
// function to accept specified words in the spellcheck
9794
// it works by finding (span) elements with IDs in the format
9895
// word_# and when found sets the content of the span
9996
// to be just the word thereby removing the select and button
100-
function acceptWord(wordIDprefix, wordNumber) {
97+
export function acceptWord(wordIDprefix, wordNumber) {
10198
var wordID = wordIDprefix + "_" + wordNumber;
10299

103100
// Get the original word
@@ -142,19 +139,19 @@ function acceptWord(wordIDprefix, wordNumber) {
142139
}
143140
window.acceptWord = acceptWord;
144141

145-
function evaluateWordChange(wordID) {
142+
export function evaluateWordChange(wordID) {
146143
if (isWordChanged(wordID)) markPageChanged();
147144
}
148145
window.evaluateWordChange = evaluateWordChange;
149146

150147
// store wordID for char pickers to use
151-
function markBox(wordID) {
148+
export function markBox(wordID) {
152149
top.txtBoxID = wordID;
153150
}
154151
window.markBox = markBox;
155152

156153
// Confirm exit if changes have been made
157-
function confirmExit() {
154+
export function confirmExit() {
158155
// see if changes have been made
159156
var changesMade = document.getElementById("is_changed").value;
160157
if (changesMade == 1) {

0 commit comments

Comments
 (0)