1.0.2 • Published 5 years ago

@daozhao/translate_selection v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

translate_selection

translate and replace the selection words

Start

import TranslateSelection from "translate_selection";
const ts = new TranslateSelection();
ts.start();

You can also overwrite the getWords and getTranslate methods for your project

/**
 *
 * @param clonedFragment return from Range.cloneContents
 * @param textArr = [] the words get from the clonedFragment
 * @returns textArr
 */
function getWords(clonedFragment, textArr) : array

/**
 * 
 * @param arr this.selectedWords
 * @returns translatedWordArr
 */
function getTranslate(arr: array) : array