|
@@ -444,7 +444,13 @@ export default class RichTextEditor extends Component {
|
444
|
444
|
}
|
445
|
445
|
|
446
|
446
|
insertLink(url, title) {
|
447
|
|
- this._sendAction(actions.insertLink, {url, title: title || url});
|
|
447
|
+ // 不填写标题,则采用链接作为url
|
|
448
|
+ title = title || url;
|
|
449
|
+ // 如果前没有http://,则需要加入
|
|
450
|
+ if (!(/^(http:\/\/|https:\/\/)/.test(url))) {
|
|
451
|
+ url = `http://${url}`;
|
|
452
|
+ }
|
|
453
|
+ this._sendAction(actions.insertLink, {url, title});
|
448
|
454
|
// if (/^(http:\/\/|https:\/\/)/.test(url)) {
|
449
|
455
|
// this._sendAction(actions.insertLink, {url, title: title || url});
|
450
|
456
|
// } else {
|
|
@@ -453,7 +459,13 @@ export default class RichTextEditor extends Component {
|
453
|
459
|
}
|
454
|
460
|
|
455
|
461
|
updateLink(url, title) {
|
456
|
|
- this._sendAction(actions.updateLink, {url, title: title || url});
|
|
462
|
+ // 不填写标题,则采用链接作为url
|
|
463
|
+ title = title || url;
|
|
464
|
+ // 如果前没有http://,则需要加入
|
|
465
|
+ if (!(/^(http:\/\/|https:\/\/)/.test(url))) {
|
|
466
|
+ url = `http://${url}`;
|
|
467
|
+ }
|
|
468
|
+ this._sendAction(actions.updateLink, {url, title});
|
457
|
469
|
// if (/^(http:\/\/|https:\/\/)/.test(url)) {
|
458
|
470
|
// this._sendAction(actions.updateLink, {url, title: title || url});
|
459
|
471
|
// } else {
|