小编San*_*eep的帖子

Chrome版本58的Redactor编辑器文本格式问题

我们使用的是Redactor(https://imperavi.com/redactor/)版本10.1.1,由于对项目的依赖性很大,我们没有迁移到Redactor II.

最近我们在Chrome 58版本面临一个非常奇怪的问题.问题是:

- 无法为所选文本格式化粗体,斜体,下划线,sup,sub等

请告诉我们是否有任何解决方法.任何形式的帮助将不胜感激.

根据公认的解决方案更新:

// Provided solution is tested for Redactor version 10.1.1
createMarkers: function()
{
    this.selection.get();

    var node1 = this.selection.getMarker(1);

    this.selection.setMarker(this.range, node1, true);

    if (this.range.collapsed === false) {
        var node2 = this.selection.getMarker(2);
        this.selection.setMarker(this.range, node2, false);

        // Fix for Chrome58 Issues
        if (this.utils.browser('chrome')) {
              this.caret.set(node1, 0, node2, 0);
         }
         // End Chrome58 Issues
    }

    this.savedSel = this.$editor.html();
},
Run Code Online (Sandbox Code Playgroud)

wysiwyg google-chrome text-editor angularjs redactor.js

24
推荐指数
1
解决办法
2552
查看次数

HTML5 draggable ='false'在Firefox浏览器中不起作用

我只是尝试将HTML5 draggable ='false'属性应用于某些图像,但它在Firefox浏览器中不起作用.在Chrome中工作正常但在Firefox上,选择了能够拖放的图像.示例代码可以在这里看到:

<div id="dnd">
    <textarea placeholder="drop here"></textarea>
    <img src="http://johnlewis.scene7.com/is/image/JohnLewis/231108668?$prod_main$" draggable='false'/>
</div>
Run Code Online (Sandbox Code Playgroud)

的jsfiddle

我有Firefox最新版本:32.0.3

谷歌很多,但没有找到更好的解决方案.有没有使用JavaScript的解决方案?任何帮助,将不胜感激.

谢谢

javascript html5 drag-and-drop draggable

16
推荐指数
3
解决办法
8589
查看次数

Web组件(本机UI)之间如何通信?

我正在尝试为我的UI项目之一使用本机Web组件,并且对于此项目,我没有使用任何框架或库(例如Polymer等)。我想知道在两者之间有什么最佳的交流方式或其他方式像我们在angularjs / angular中所做的那样的Web组件(例如消息总线概念)。

当前,在UI Web组件中,我正在使用dispatchevent发布数据和接收数据,正在使用addeventlistener。例如,有2个Web组件,ChatForm和ChatHistory。

// chatform webcomponent on submit text, publish chattext data 
this.dispatchEvent(new CustomEvent('chatText', {detail: chattext}));

// chathistory webcomponent, receive chattext data and append it to chat list
this.chatFormEle.addEventListener('chatText', (v) => {console.log(v.detail);});
Run Code Online (Sandbox Code Playgroud)

请让我知道实现此目的的其他方法。任何可以轻松与本机UI Web组件集成的优秀库,如postaljs等。

html javascript web-component custom-element native-web-component

4
推荐指数
3
解决办法
777
查看次数