yomidevs / yomitan

Pop-up dictionary browser extension. Successor to Yomichan.
https://yomitan.wiki
GNU General Public License v3.0
1.23k stars 97 forks source link

Show sentence even if parsing.enableScanningParser is false #1370

Open jamesmaa opened 1 month ago

jamesmaa commented 1 month ago

Currently yomitan doesn't show the sentence if the parser is turned off

image

outcome: image

We should still show the original sentence even if we turn off the sentence parser. This lets users select words within a sentence even if i sentence remains unparsed

related: #1369

austinyu12 commented 1 week ago

I would like to be assigned this.

jamesmaa commented 1 week ago

i don't think anyone's working on this but anyone who wants to can check in here as well

austinyu12 commented 4 days ago

Been having trouble trying to locate the logic that will update the sentence that is a header on the search page. I think I am on the right path with something like this.

async setText(text) {
        if (this._useInternalParser === false && this._useMecabParser === false) {
            return;
        } // all the code from here on can be skipped if no need to parse
        this._text = text;
        this._setPreview(text);

        /** @type {?import('core').TokenObject} */
        const token = {};
        this._setTextToken = token;
        this._parseResults = await this._api.parseText(text, this._getOptionsContext(), this._scanLength, this._useInternalParser, this._useMecabParser);
        if (this._setTextToken !== token) { return; }

        this._refreshSelectedParser();

        this._renderParserSelect();
        this._renderParseResult();
    }
jamesmaa commented 4 days ago

I think you're in the right file! Feel free to add console.log statements or console.trace statements or try to walk through this with a debugger to see how it all works. Some documentation on using the debugger https://developer.chrome.com/docs/devtools/javascript#code-stepping