首页 > 解决方案 > 角度表情符号选择器在 Windows 7 上不起作用

问题描述

我有一个角度项目,在我的项目中,我使用@joeattardi/emoji-button 插件将表情符号选择器添加到我的聊天框中

这是模板

<form action="" class="type-message">
        <input type="text" placeholder="{{ 'meeting-side.write-message' | translate }}" id="newMessage"
            (keyup.enter)="sendMessage()" [(ngModel)]="newMessage" [ngModelOptions]="{standalone: true}"  autocomplete="off" required>
        <div class="actions-row">
            <div class="icons-actions">
                <mat-icon id="emojiButton" matTooltip="{{'meeting-side.add-emoji' | translate}}" matTooltipClass="custom-tooltip">sentiment_satisfied_alt</mat-icon>
            </div>
            <a (click)="sendMessage()" [ngClass]="{'disabled': !newMessage}">
                {{ "meeting-side.send" | translate }}
            </a>
        </div>
    </form>

在我的 component.ts 代码中我添加了这个代码

ngAfterViewInit() {
    this.cdRef.detectChanges();

    let button = document.querySelector('#emojiButton') as HTMLButtonElement;
    let picker = new EmojiButton({
      autoHide: false
    });
    
    let input = document.querySelector('#newMessage') as HTMLInputElement;

    picker.on('emoji', emoji => {
      this.newMessage += emoji;
    });

    button.addEventListener('click', () => {
      picker.togglePicker(button);
    });
  }

当我在 linux、windows 10 和 mac 上测试我的应用程序时,一切正常,但是当我在 windows 7 上测试时,它看起来像这样 在此处输入图像描述

请帮助我如何使这个插件支持 Windows 7 或对任何 MIT 插件的任何建议支持所有操作系统。

谢谢你

标签: javascriptangularwebfrontendemoji

解决方案


这是与在旧操作系统中支持表情符号有关的问题。只有较新的操作系统支持您期望的所有表情符号。

在 Windows 7 发布后,一些表情符号作为不同 Unicode 版本的一部分发布。

使用一些第三方可能有助于解决这个问题,但我真的不认为有可能修复所有丢失的表情符号。例如,Windows 7 有更新 ( KB2729094 ),它提供 unicode emoji 支持(Segoe UI的更新)。但是,仍然缺少一些新的表情符号,并且它们是黑白的。


推荐阅读