-
Notifications
You must be signed in to change notification settings - Fork 412
CLDR-18954 Use tags (chits) in ST value input dialog #5161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
-Revise AddValue.vue to support new child component AddValueTags.vue -Move template to top for consistency with most of our Vue components (we should decide on a consistent convention) -New radio buttons enable choosing between default Text mode and new Tags mode -Implement tags with a-tag from Ant Design Vue, see https://www.antdv.com/components/tag -Display one tag for each Unicode code point; hover shows USV and Unicode name, see https://www.npmjs.com/package/unicode-name -Enable inserting new tags with [+] buttons that appear between tags, before the first tag, and following the last tag -Each tag has [x] button for deleting the tag -Enable inputting a character either directly or by its USV (U+...)
-Also remove defineEmits from AddValueTags.vue
|
Please note that the ticket is still "investigate", and this PR is intended to illustrate possibilities rather than a final design. Screenshots are based on running ST locally with these changes.
The input dialog shown above has new "Input mode" radio buttons, and the winning value has just been inserted by clicking the "Winning" button. The path is https://st.unicode.org/cldr-apps/v#/am/Gregorian/471a794c61b793f4 .
After choosing "Tags", hovering on the first tag shows the USV and character name.
After clicking on the leftmost [+], an input box is displayed for inserting a character. The user has typed "A".
After clicking on the rightmost [+], an input box is displayed for inserting a character. The user has typed "U+20000".
After pressing Return or clicking outside the input box, the character 𠀀 is displayed and the hover shows the USV and character name.
Hovering on "Text" or "Tags" shows description of the input mode. Note that a checkbox could be used instead, or there could be more than two modes. For example, sequences of ordinary characters could be combined in one tag, and separate tags could be displayed only for special characters such as thin spaces. Or, text and tags could be displayed simultaneously. Or, additional controls could be displayed for choosing from a palette of special characters to input. |
|
So far (commits 1 and 2) this PR only supports the conventional U+... notation (plus character names) to help identify characters. A likely enhancement would be to add support for codes like ❰TSP❱ for thin space; see https://cldr.unicode.org/translation/core-data/exemplars#key-to-escapes |
|
The goal is to be able to pull down a menu to enter a chit that looks like
{0}|{1}
{0} Moreover, clicking down, dragging with the mouse, using arrow keys, or or backspace treat The menu would contain the enums in CodePointEscaper (except for the SP and later). The package I pointed to seems to do all of this, based on their demo. What you have in the screenshots doesn't do that. We can talk more next week about whether we can get a package that does (and can integrate easily). |
I tried the Tagify demo some more (specifically "Mix text & tags"), and I found that copy/paste doesn't actually work correctly with the tags. When you paste a tag, it's not a tag anymore. Even if we could fix or work around the bugs and use Tagify or something like it in a Vue component, it seems doubtful whether it would work well enough to meet the needs of all ST users, especially taking into account various input methods (like CJK) and RTL languages. The most robust interface would always give users the option of using standard text-editing features, with tags/chits as a non-obligatory alternative. That's my impression, though I'm open-minded. I'm not sure what you mean by a "well" in this context. Do you mean a palette of tags, off to the side of the text input box? The closest thing to that in the Tagify demos might be the section with the header "Render suggestions list manually". I do think it would be possible to implement something like that with Ant Design Vue. Also, the ticket description mentions an "XML representation" and using DAIP to convert it. That's not clear to me. It seems to me that the underlying value will always be a Unicode string without markup. If an alternative representation (such as XML) is needed to facilitate implementing the UI, that would be strictly the concern of the front end, so DAIP wouldn't be involved. Anyway I've learned a lot from working on this code. I think Ant Design Vue has more potential than is obvious from the screenshots or the code I've written so far, though I doubt any library will perfectly support a mixture of text and tags for full-fledged copy/paste/etc., unless there is an option to edit the raw text without interference from the library. I still need a clearer idea of what you have in mind, in terms of which paths would have the new features (all paths that allow thin spaces? exemplars? ...) and what the user interface would look like. |
-Revise AddValue.vue to support new child components AddValueTagsReadOnly.vue, AddValueTagsEdit.vue -Move template to top for consistency with most of our Vue components (we should decide on a consistent convention) -Implement tags with a-tag from Ant Design Vue, see https://www.antdv.com/components/tag -For now, display one tag for each Unicode code point; hover shows USV and Unicode name, see https://www.npmjs.com/package/unicode-name -New cldrChar.mjs encapsulates usage of unicode-name and other utilities for parsing strings into characters, identifying white space characters, etc. -Configuration const booleans support various modes: if USE_TAGS is false, there are no tags -If CAN_EDIT_TAGS is true, tags can be directly inserted/deleted, otherwise they are read-only -If CAN_EDIT_TAGS is true, enable inserting new tags with [+] buttons that appear between tags, before the first tag, and following the last tag; each tag has [x] button for deleting the tag; enable inputting a character either directly or by its USV (U+...) -If SHOW_RADIO is true, new radio buttons enable choosing between default Text mode and new Tags mode -If SHOW_TAGS_AND_TEXT_TOGETHER is true, there are no radio buttons
-Revise AddValue.vue to support new child components AddValueTagsReadOnly.vue, AddValueTagsEdit.vue -Move template to top for consistency with most of our Vue components (we should decide on a consistent convention) -Implement tags with a-tag from Ant Design Vue, see https://www.antdv.com/components/tag -For now, display one tag for each Unicode code point; hover shows USV and Unicode name, see https://www.npmjs.com/package/unicode-name -New cldrChar.mjs encapsulates usage of unicode-name and other utilities for parsing strings into characters, identifying white space characters, etc. -Configuration const booleans support various modes: if USE_TAGS is false, there are no tags -If CAN_EDIT_TAGS is true, tags can be directly inserted/deleted, otherwise they are read-only -If CAN_EDIT_TAGS is true, enable inserting new tags with [+] buttons that appear between tags, before the first tag, and following the last tag; each tag has [x] button for deleting the tag; enable inputting a character either directly or by its USV (U+...) -If SHOW_RADIO is true, new radio buttons enable choosing between default Text mode and new Tags mode -If SHOW_TAGS_AND_TEXT_TOGETHER is true, there are no radio buttons
-Revise AddValue.vue to support new child components AddValueTagsBasic.vue, AddValueTagsEdit.vue -Move template to top for consistency with most of our Vue components (we should decide on a consistent convention) -Implement tags with a-tag from Ant Design Vue, see https://www.antdv.com/components/tag -For now, display one tag for each Unicode code point; hover shows USV and Unicode name, see https://www.npmjs.com/package/unicode-name -New cldrChar.mjs encapsulates usage of unicode-name and other utilities for parsing strings into characters, identifying white space characters, etc. -Configuration booleans support various modes: for now, if DEBUG is false, there are no tags -If DEBUG is true, Shift-clicking the Cancel button invokes secret menu with checkboxes to enable dev features -If canEditTags is true, tags can be directly inserted/deleted, otherwise they are read-only -If canEditTags is true, enable inserting new tags with [+] buttons that appear between tags, before the first tag, and following the last tag; each tag has [x] button for deleting the tag; enable inputting a character either directly or by its USV (U+...) -If showRadio is true, new radio buttons enable choosing between default Text mode and new Tags mode -If showRadio is false, there are no radio buttons; instead, text and tags are shown together











-Revise AddValue.vue to support new child component AddValueTags.vue
-Move template to top for consistency with most of our Vue components (we should decide on a consistent convention)
-New radio buttons enable choosing between default Text mode and new Tags mode
-Implement tags with a-tag from Ant Design Vue, see https://www.antdv.com/components/tag
-Display one tag for each Unicode code point; hover shows USV and Unicode name, see https://www.npmjs.com/package/unicode-name
-Enable inserting new tags with [+] buttons that appear between tags, before the first tag, and following the last tag
-Each tag has [x] button for deleting the tag
-Enable inputting a character either directly or by its USV (U+...)
CLDR-18954
ALLOW_MANY_COMMITS=true