question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

on Safari Autocompleter ch: @ in Chinese IME is not working

See original GitHub issue

What is the current behavior? Describe the bug

I’m working on tinymce use Autocompleter when user input @ can show some quickly function such as insert ‘hr’. I test on Chrome is ok whenerver Chinese IME or English IME but in Safari, it is not working on Chinese IME

Please provide the steps to reproduce and if possible a minimal demo of the problem via [fiddle.tiny.cloud]

var specialChars = [
  { text: 'exclamation mark', value: '!' },
  { text: 'at', value: '@' },
  { text: 'hash', value: '#' },
  { text: 'dollars', value: '$' },
  { text: 'percent sign', value: '%' },
  { text: 'caret', value: '^' },
  { text: 'ampersand', value: '&' },
  { text: 'asterisk', value: '*' }
];

tinymce.init({
  selector: 'textarea#autocompleter',
  height: 250,
  setup: function (editor) {
    /* An autocompleter that allows you to insert special characters */
    editor.ui.registry.addAutocompleter('specialchars', {
      ch: '@',
      minChars: 0,
      columns: 'auto',
      fetch: function (pattern) {
        var matchedChars = specialChars.filter(function (char) {
          return char.text.indexOf(pattern) !== -1;
        });

        return new tinymce.util.Promise(function (resolve) {
          var results = matchedChars.map(function (char) {
            return {
              value: char.value,
              text: char.text,
              icon: char.value
            }
          });
          resolve(results);
        });
      },
      onAction: function (autocompleteApi, rng, value) {
        editor.selection.setRng(rng);
        editor.insertContent(value);
        autocompleteApi.hide();
      }
    });
  },
  content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
});

What is the expected behavior?

  • [√ ] Chrome is ok

  • [ ×] Safari is not ok when Chinese IME

Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE?

  1. TinyMCE version:5.5.0
  2. Safari version:14.0 (15610.1.28.1.9, 15610)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lnewsoncommented, Nov 3, 2020

Hi @roy2651, as you’ve mentioned Safari is not firing the keypress nor compositionend events, unlike every other browser. This is something we’ll need to address, but as a “hacky” workaround in the interim you could do something like this: https://fiddle.tiny.cloud/hxhaab. Anyways, I’ve logged this in our internal and we’ll let you know when a fix is available.

0reactions
zhoufenfenscommented, Nov 9, 2020

hi @lnewson this code works ok on Safari,but you know in Windows Chinese IME has some different IME,such as Microsoft pinyin so these can’t work on keypress

so I find in Autocompleter.ts I add some code such as

editor.on('keyup',function(e) {
     if(e.key === '@' || e.shiftKey && e.keyCode === 229 && e.code === 'Digit2') {
       load()
     }
})

you can send triggerChar to replace @

I glad to hear some progress on this issue

Sorry about my bad English

等进度太慢,我直接改了源码,压缩后的,很痛苦

Read more comments on GitHub >

github_iconTop Results From Across the Web

If AutoFill doesn't work in Safari on Mac - Apple Support
In the Safari app on your Mac, choose Safari > Settings, click AutoFill, then make sure “User names and passwords” is selected.
Read more >
[Web] Character duplicating when using IME Chinese inputs ...
I cannot reproduce this issue on Chrome, so it's probably related to Safari. Steps to reproduce the issue: Enable Sucheng Input method (or...
Read more >
Microsoft Traditional Chinese IME
This page helps you with how to use Microsoft Traditional Chinese IME including IME features and keyboard shortcuts.
Read more >
What to do if Safari AutoFill is not working
If Safari AutoFill has stopped working on your Mac, you might be wondering what went wrong? We've got all the tips you need...
Read more >
SpN - River Thames Conditions
2004 impala problems starting, Helios klinikum aue chirurgie! ... Hindi movie cocktail cast, Autocomplete vim typing, Nys tesol journal, Video ultraman vs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found