mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 21:11:55 +08:00
commit
87430a20a7
84
extensions/mentions/js/forum/dist/extension.js
vendored
84
extensions/mentions/js/forum/dist/extension.js
vendored
|
@ -132,6 +132,8 @@ if (typeof module != 'undefined' && typeof module.exports != 'undefined') {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/addComposerAutocomplete', ['flarum/extend', 'flarum/components/ComposerBody', 'flarum/helpers/avatar', 'flarum/helpers/username', 'flarum/helpers/highlight', 'flarum/utils/KeyboardNavigatable', 'flarum/utils/string', 'flarum/mentions/components/AutocompleteDropdown'], function (_export, _context) {
|
System.register('flarum/mentions/addComposerAutocomplete', ['flarum/extend', 'flarum/components/ComposerBody', 'flarum/helpers/avatar', 'flarum/helpers/username', 'flarum/helpers/highlight', 'flarum/utils/KeyboardNavigatable', 'flarum/utils/string', 'flarum/mentions/components/AutocompleteDropdown'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var extend, ComposerBody, avatar, usernameHelper, highlight, KeyboardNavigatable, truncate, AutocompleteDropdown;
|
var extend, ComposerBody, avatar, usernameHelper, highlight, KeyboardNavigatable, truncate, AutocompleteDropdown;
|
||||||
function addComposerAutocomplete() {
|
function addComposerAutocomplete() {
|
||||||
extend(ComposerBody.prototype, 'config', function (original, isInitialized) {
|
extend(ComposerBody.prototype, 'config', function (original, isInitialized) {
|
||||||
|
@ -333,6 +335,8 @@ System.register('flarum/mentions/addComposerAutocomplete', ['flarum/extend', 'fl
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/addMentionedByList', ['flarum/extend', 'flarum/Model', 'flarum/models/Post', 'flarum/components/CommentPost', 'flarum/components/PostPreview', 'flarum/helpers/punctuateSeries', 'flarum/helpers/username', 'flarum/helpers/icon'], function (_export, _context) {
|
System.register('flarum/mentions/addMentionedByList', ['flarum/extend', 'flarum/Model', 'flarum/models/Post', 'flarum/components/CommentPost', 'flarum/components/PostPreview', 'flarum/helpers/punctuateSeries', 'flarum/helpers/username', 'flarum/helpers/icon'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var extend, Model, Post, CommentPost, PostPreview, punctuateSeries, username, icon;
|
var extend, Model, Post, CommentPost, PostPreview, punctuateSeries, username, icon;
|
||||||
function addMentionedByList() {
|
function addMentionedByList() {
|
||||||
Post.prototype.mentionedBy = Model.hasMany('mentionedBy');
|
Post.prototype.mentionedBy = Model.hasMany('mentionedBy');
|
||||||
|
@ -490,6 +494,8 @@ System.register('flarum/mentions/addMentionedByList', ['flarum/extend', 'flarum/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/addPostMentionPreviews', ['flarum/extend', 'flarum/components/CommentPost', 'flarum/components/PostPreview', 'flarum/components/LoadingIndicator'], function (_export, _context) {
|
System.register('flarum/mentions/addPostMentionPreviews', ['flarum/extend', 'flarum/components/CommentPost', 'flarum/components/PostPreview', 'flarum/components/LoadingIndicator'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var extend, CommentPost, PostPreview, LoadingIndicator;
|
var extend, CommentPost, PostPreview, LoadingIndicator;
|
||||||
function addPostMentionPreviews() {
|
function addPostMentionPreviews() {
|
||||||
extend(CommentPost.prototype, 'config', function () {
|
extend(CommentPost.prototype, 'config', function () {
|
||||||
|
@ -638,15 +644,17 @@ System.register('flarum/mentions/addPostMentionPreviews', ['flarum/extend', 'fla
|
||||||
});;
|
});;
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/addPostQuoteButton', ['flarum/extend', 'flarum/components/CommentPost', 'flarum/mentions/components/PostQuoteButton'], function (_export, _context) {
|
System.register('flarum/mentions/addPostQuoteButton', ['flarum/extend', 'flarum/components/CommentPost', 'flarum/mentions/components/PostQuoteButton', 'flarum/mentions/utils/selectedText'], function (_export, _context) {
|
||||||
var extend, CommentPost, PostQuoteButton;
|
"use strict";
|
||||||
|
|
||||||
|
var extend, CommentPost, PostQuoteButton, selectedText;
|
||||||
function addPostQuoteButton() {
|
function addPostQuoteButton() {
|
||||||
extend(CommentPost.prototype, 'config', function (original, isInitialized) {
|
extend(CommentPost.prototype, 'config', function (original, isInitialized) {
|
||||||
var post = this.props.post;
|
var post = this.props.post;
|
||||||
|
|
||||||
if (isInitialized || post.isHidden() || app.session.user && !post.discussion().canReply()) return;
|
if (isInitialized || post.isHidden() || app.session.user && !post.discussion().canReply()) return;
|
||||||
|
|
||||||
var $postBody = this.$().find('.Post-body');
|
var $postBody = this.$('.Post-body');
|
||||||
|
|
||||||
// Wrap the quote button in a wrapper element so that we can render
|
// Wrap the quote button in a wrapper element so that we can render
|
||||||
// button into it.
|
// button into it.
|
||||||
|
@ -654,20 +662,12 @@ System.register('flarum/mentions/addPostQuoteButton', ['flarum/extend', 'flarum/
|
||||||
|
|
||||||
this.$().after($container).on('mouseup', function (e) {
|
this.$().after($container).on('mouseup', function (e) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var selection = window.getSelection();
|
var content = selectedText($postBody);
|
||||||
|
|
||||||
if (selection.rangeCount) {
|
|
||||||
var range = selection.getRangeAt(0);
|
|
||||||
var parent = range.commonAncestorContainer;
|
|
||||||
|
|
||||||
if ($postBody[0] === parent || $.contains($postBody[0], parent)) {
|
|
||||||
var content = selection.toString();
|
|
||||||
|
|
||||||
if (content) {
|
if (content) {
|
||||||
var button = new PostQuoteButton({ post: post, content: content });
|
var button = new PostQuoteButton({ post: post, content: content });
|
||||||
m.render($container[0], button.render());
|
m.render($container[0], button.render());
|
||||||
|
|
||||||
var rects = range.getClientRects();
|
var rects = window.getSelection().getRangeAt(0).getClientRects();
|
||||||
var firstRect = rects[0];
|
var firstRect = rects[0];
|
||||||
|
|
||||||
if (e.clientY < firstRect.bottom && e.clientX - firstRect.right < firstRect.left - e.clientX) {
|
if (e.clientY < firstRect.bottom && e.clientX - firstRect.right < firstRect.left - e.clientX) {
|
||||||
|
@ -677,8 +677,6 @@ System.register('flarum/mentions/addPostQuoteButton', ['flarum/extend', 'flarum/
|
||||||
button.showEnd(lastRect.right, lastRect.bottom);
|
button.showEnd(lastRect.right, lastRect.bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -693,17 +691,22 @@ System.register('flarum/mentions/addPostQuoteButton', ['flarum/extend', 'flarum/
|
||||||
CommentPost = _flarumComponentsCommentPost.default;
|
CommentPost = _flarumComponentsCommentPost.default;
|
||||||
}, function (_flarumMentionsComponentsPostQuoteButton) {
|
}, function (_flarumMentionsComponentsPostQuoteButton) {
|
||||||
PostQuoteButton = _flarumMentionsComponentsPostQuoteButton.default;
|
PostQuoteButton = _flarumMentionsComponentsPostQuoteButton.default;
|
||||||
|
}, function (_flarumMentionsUtilsSelectedText) {
|
||||||
|
selectedText = _flarumMentionsUtilsSelectedText.default;
|
||||||
}],
|
}],
|
||||||
execute: function () {}
|
execute: function () {}
|
||||||
};
|
};
|
||||||
});;
|
});;
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/addPostReplyAction', ['flarum/extend', 'flarum/components/Button', 'flarum/components/CommentPost', 'flarum/mentions/utils/reply'], function (_export, _context) {
|
System.register('flarum/mentions/addPostReplyAction', ['flarum/extend', 'flarum/components/Button', 'flarum/components/CommentPost', 'flarum/mentions/utils/reply', 'flarum/mentions/utils/selectedText'], function (_export, _context) {
|
||||||
var extend, Button, CommentPost, reply;
|
"use strict";
|
||||||
|
|
||||||
|
var extend, Button, CommentPost, reply, selectedText;
|
||||||
|
|
||||||
_export('default', function () {
|
_export('default', function () {
|
||||||
extend(CommentPost.prototype, 'actionItems', function (items) {
|
extend(CommentPost.prototype, 'actionItems', function (items) {
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
var post = this.props.post;
|
var post = this.props.post;
|
||||||
|
|
||||||
|
@ -713,8 +716,7 @@ System.register('flarum/mentions/addPostReplyAction', ['flarum/extend', 'flarum/
|
||||||
className: 'Button Button--link',
|
className: 'Button Button--link',
|
||||||
children: app.translator.trans('flarum-mentions.forum.post.reply_link'),
|
children: app.translator.trans('flarum-mentions.forum.post.reply_link'),
|
||||||
onclick: function onclick() {
|
onclick: function onclick() {
|
||||||
var quote = window.getSelection().toString();
|
reply(post, selectedText(_this.$('.Post-body')));
|
||||||
reply(post, quote);
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -729,6 +731,8 @@ System.register('flarum/mentions/addPostReplyAction', ['flarum/extend', 'flarum/
|
||||||
CommentPost = _flarumComponentsCommentPost.default;
|
CommentPost = _flarumComponentsCommentPost.default;
|
||||||
}, function (_flarumMentionsUtilsReply) {
|
}, function (_flarumMentionsUtilsReply) {
|
||||||
reply = _flarumMentionsUtilsReply.default;
|
reply = _flarumMentionsUtilsReply.default;
|
||||||
|
}, function (_flarumMentionsUtilsSelectedText) {
|
||||||
|
selectedText = _flarumMentionsUtilsSelectedText.default;
|
||||||
}],
|
}],
|
||||||
execute: function () {}
|
execute: function () {}
|
||||||
};
|
};
|
||||||
|
@ -736,6 +740,8 @@ System.register('flarum/mentions/addPostReplyAction', ['flarum/extend', 'flarum/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/components/AutocompleteDropdown', ['flarum/Component'], function (_export, _context) {
|
System.register('flarum/mentions/components/AutocompleteDropdown', ['flarum/Component'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var Component, AutocompleteDropdown;
|
var Component, AutocompleteDropdown;
|
||||||
return {
|
return {
|
||||||
setters: [function (_flarumComponent) {
|
setters: [function (_flarumComponent) {
|
||||||
|
@ -853,6 +859,8 @@ System.register('flarum/mentions/components/AutocompleteDropdown', ['flarum/Comp
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/components/MentionsUserPage', ['flarum/components/PostsUserPage'], function (_export, _context) {
|
System.register('flarum/mentions/components/MentionsUserPage', ['flarum/components/PostsUserPage'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var PostsUserPage, MentionsUserPage;
|
var PostsUserPage, MentionsUserPage;
|
||||||
return {
|
return {
|
||||||
setters: [function (_flarumComponentsPostsUserPage) {
|
setters: [function (_flarumComponentsPostsUserPage) {
|
||||||
|
@ -890,6 +898,8 @@ System.register('flarum/mentions/components/MentionsUserPage', ['flarum/componen
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/components/PostMentionedNotification', ['flarum/components/Notification', 'flarum/helpers/username', 'flarum/helpers/punctuateSeries'], function (_export, _context) {
|
System.register('flarum/mentions/components/PostMentionedNotification', ['flarum/components/Notification', 'flarum/helpers/username', 'flarum/helpers/punctuateSeries'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var Notification, username, punctuateSeries, PostMentionedNotification;
|
var Notification, username, punctuateSeries, PostMentionedNotification;
|
||||||
return {
|
return {
|
||||||
setters: [function (_flarumComponentsNotification) {
|
setters: [function (_flarumComponentsNotification) {
|
||||||
|
@ -951,6 +961,8 @@ System.register('flarum/mentions/components/PostMentionedNotification', ['flarum
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/components/PostQuoteButton', ['flarum/components/Button', 'flarum/utils/extract', 'flarum/mentions/utils/reply'], function (_export, _context) {
|
System.register('flarum/mentions/components/PostQuoteButton', ['flarum/components/Button', 'flarum/utils/extract', 'flarum/mentions/utils/reply'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var Button, extract, reply, PostQuoteButton;
|
var Button, extract, reply, PostQuoteButton;
|
||||||
return {
|
return {
|
||||||
setters: [function (_flarumComponentsButton) {
|
setters: [function (_flarumComponentsButton) {
|
||||||
|
@ -1027,6 +1039,8 @@ System.register('flarum/mentions/components/PostQuoteButton', ['flarum/component
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/components/UserMentionedNotification', ['flarum/components/Notification'], function (_export, _context) {
|
System.register('flarum/mentions/components/UserMentionedNotification', ['flarum/components/Notification'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var Notification, UserMentionedNotification;
|
var Notification, UserMentionedNotification;
|
||||||
return {
|
return {
|
||||||
setters: [function (_flarumComponentsNotification) {
|
setters: [function (_flarumComponentsNotification) {
|
||||||
|
@ -1076,6 +1090,8 @@ System.register('flarum/mentions/components/UserMentionedNotification', ['flarum
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/main', ['flarum/extend', 'flarum/app', 'flarum/components/NotificationGrid', 'flarum/utils/string', 'flarum/mentions/addPostMentionPreviews', 'flarum/mentions/addMentionedByList', 'flarum/mentions/addPostReplyAction', 'flarum/mentions/addPostQuoteButton', 'flarum/mentions/addComposerAutocomplete', 'flarum/mentions/components/PostMentionedNotification', 'flarum/mentions/components/UserMentionedNotification', 'flarum/components/UserPage', 'flarum/components/LinkButton', 'flarum/mentions/components/MentionsUserPage'], function (_export, _context) {
|
System.register('flarum/mentions/main', ['flarum/extend', 'flarum/app', 'flarum/components/NotificationGrid', 'flarum/utils/string', 'flarum/mentions/addPostMentionPreviews', 'flarum/mentions/addMentionedByList', 'flarum/mentions/addPostReplyAction', 'flarum/mentions/addPostQuoteButton', 'flarum/mentions/addComposerAutocomplete', 'flarum/mentions/components/PostMentionedNotification', 'flarum/mentions/components/UserMentionedNotification', 'flarum/components/UserPage', 'flarum/components/LinkButton', 'flarum/mentions/components/MentionsUserPage'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var extend, app, NotificationGrid, getPlainContent, addPostMentionPreviews, addMentionedByList, addPostReplyAction, addPostQuoteButton, addComposerAutocomplete, PostMentionedNotification, UserMentionedNotification, UserPage, LinkButton, MentionsUserPage;
|
var extend, app, NotificationGrid, getPlainContent, addPostMentionPreviews, addMentionedByList, addPostReplyAction, addPostQuoteButton, addComposerAutocomplete, PostMentionedNotification, UserMentionedNotification, UserPage, LinkButton, MentionsUserPage;
|
||||||
return {
|
return {
|
||||||
setters: [function (_flarumExtend) {
|
setters: [function (_flarumExtend) {
|
||||||
|
@ -1167,6 +1183,8 @@ System.register('flarum/mentions/main', ['flarum/extend', 'flarum/app', 'flarum/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
System.register('flarum/mentions/utils/reply', ['flarum/utils/DiscussionControls'], function (_export, _context) {
|
System.register('flarum/mentions/utils/reply', ['flarum/utils/DiscussionControls'], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var DiscussionControls;
|
var DiscussionControls;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1208,4 +1226,32 @@ System.register('flarum/mentions/utils/reply', ['flarum/utils/DiscussionControls
|
||||||
}],
|
}],
|
||||||
execute: function () {}
|
execute: function () {}
|
||||||
};
|
};
|
||||||
|
});;
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
System.register("flarum/mentions/utils/selectedText", [], function (_export, _context) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function selectedText(body) {
|
||||||
|
var selection = window.getSelection();
|
||||||
|
if (selection.rangeCount) {
|
||||||
|
var range = selection.getRangeAt(0);
|
||||||
|
var parent = range.commonAncestorContainer;
|
||||||
|
if (body[0] === parent || $.contains(body[0], parent)) {
|
||||||
|
var clone = $("<div>").append(range.cloneContents());
|
||||||
|
clone.find('img.emoji').replaceWith(function () {
|
||||||
|
return this.alt;
|
||||||
|
});
|
||||||
|
return clone.text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
_export("default", selectedText);
|
||||||
|
|
||||||
|
return {
|
||||||
|
setters: [],
|
||||||
|
execute: function () {}
|
||||||
|
};
|
||||||
});
|
});
|
|
@ -2,6 +2,7 @@ import { extend } from 'flarum/extend';
|
||||||
import CommentPost from 'flarum/components/CommentPost';
|
import CommentPost from 'flarum/components/CommentPost';
|
||||||
|
|
||||||
import PostQuoteButton from 'flarum/mentions/components/PostQuoteButton';
|
import PostQuoteButton from 'flarum/mentions/components/PostQuoteButton';
|
||||||
|
import selectedText from 'flarum/mentions/utils/selectedText';
|
||||||
|
|
||||||
export default function addPostQuoteButton() {
|
export default function addPostQuoteButton() {
|
||||||
extend(CommentPost.prototype, 'config', function(original, isInitialized) {
|
extend(CommentPost.prototype, 'config', function(original, isInitialized) {
|
||||||
|
@ -9,7 +10,7 @@ export default function addPostQuoteButton() {
|
||||||
|
|
||||||
if (isInitialized || post.isHidden() || (app.session.user && !post.discussion().canReply())) return;
|
if (isInitialized || post.isHidden() || (app.session.user && !post.discussion().canReply())) return;
|
||||||
|
|
||||||
const $postBody = this.$().find('.Post-body');
|
const $postBody = this.$('.Post-body');
|
||||||
|
|
||||||
// Wrap the quote button in a wrapper element so that we can render
|
// Wrap the quote button in a wrapper element so that we can render
|
||||||
// button into it.
|
// button into it.
|
||||||
|
@ -19,20 +20,12 @@ export default function addPostQuoteButton() {
|
||||||
.after($container)
|
.after($container)
|
||||||
.on('mouseup', function(e) {
|
.on('mouseup', function(e) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const selection = window.getSelection();
|
const content = selectedText($postBody);
|
||||||
|
|
||||||
if (selection.rangeCount) {
|
|
||||||
const range = selection.getRangeAt(0);
|
|
||||||
const parent = range.commonAncestorContainer;
|
|
||||||
|
|
||||||
if ($postBody[0] === parent || $.contains($postBody[0], parent)) {
|
|
||||||
const content = selection.toString();
|
|
||||||
|
|
||||||
if (content) {
|
if (content) {
|
||||||
const button = new PostQuoteButton({post, content});
|
const button = new PostQuoteButton({post, content});
|
||||||
m.render($container[0], button.render());
|
m.render($container[0], button.render());
|
||||||
|
|
||||||
const rects = range.getClientRects();
|
const rects = window.getSelection().getRangeAt(0).getClientRects();
|
||||||
const firstRect = rects[0];
|
const firstRect = rects[0];
|
||||||
|
|
||||||
if (e.clientY < firstRect.bottom && e.clientX - firstRect.right < firstRect.left - e.clientX) {
|
if (e.clientY < firstRect.bottom && e.clientX - firstRect.right < firstRect.left - e.clientX) {
|
||||||
|
@ -42,8 +35,6 @@ export default function addPostQuoteButton() {
|
||||||
button.showEnd(lastRect.right, lastRect.bottom);
|
button.showEnd(lastRect.right, lastRect.bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ import Button from 'flarum/components/Button';
|
||||||
import CommentPost from 'flarum/components/CommentPost';
|
import CommentPost from 'flarum/components/CommentPost';
|
||||||
|
|
||||||
import reply from 'flarum/mentions/utils/reply';
|
import reply from 'flarum/mentions/utils/reply';
|
||||||
|
import selectedText from 'flarum/mentions/utils/selectedText';
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
extend(CommentPost.prototype, 'actionItems', function (items) {
|
extend(CommentPost.prototype, 'actionItems', function (items) {
|
||||||
|
@ -16,8 +17,7 @@ export default function () {
|
||||||
className: 'Button Button--link',
|
className: 'Button Button--link',
|
||||||
children: app.translator.trans('flarum-mentions.forum.post.reply_link'),
|
children: app.translator.trans('flarum-mentions.forum.post.reply_link'),
|
||||||
onclick: () => {
|
onclick: () => {
|
||||||
const quote = window.getSelection().toString();
|
reply(post, selectedText(this.$('.Post-body')));
|
||||||
reply(post, quote);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
15
extensions/mentions/js/forum/src/utils/selectedText.js
Normal file
15
extensions/mentions/js/forum/src/utils/selectedText.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
export default function selectedText(body) {
|
||||||
|
const selection = window.getSelection();
|
||||||
|
if (selection.rangeCount) {
|
||||||
|
const range = selection.getRangeAt(0);
|
||||||
|
const parent = range.commonAncestorContainer;
|
||||||
|
if (body[0] === parent || $.contains(body[0], parent)) {
|
||||||
|
const clone = $("<div>").append(range.cloneContents());
|
||||||
|
clone.find('img.emoji').replaceWith(function() {
|
||||||
|
return this.alt;
|
||||||
|
});
|
||||||
|
return clone.text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user