Merge branch 'feature/rich_text_editor' of https://code.gab.com/gab/social/gab-social into develop

This commit is contained in:
mgabdev
2020-06-17 16:45:45 -04:00
23 changed files with 1181 additions and 293 deletions
+15 -10
View File
@@ -263,12 +263,12 @@ export function submitCompose(group, replyToId = null, router, isStandalone) {
if (!me) return;
let status = getState().getIn(['compose', 'text'], '');
const markdown = getState().getIn(['compose', 'markdown'], '');
let markdown = getState().getIn(['compose', 'markdown'], '');
const media = getState().getIn(['compose', 'media_attachments']);
// : hack :
//Prepend http:// to urls in status that don't have protocol
status = status.replace(urlRegex, (match, a, b, c) =>{
status = `${status}`.replace(urlRegex, (match, a, b, c) =>{
const hasProtocol = match.startsWith('https://') || match.startsWith('http://')
//Make sure not a remote mention like @someone@somewhere.com
if (!hasProtocol) {
@@ -276,15 +276,20 @@ export function submitCompose(group, replyToId = null, router, isStandalone) {
}
return hasProtocol ? match : `http://${match}`
})
// markdown = statusMarkdown.replace(urlRegex, (match) =>{
// const hasProtocol = match.startsWith('https://') || match.startsWith('http://')
// return hasProtocol ? match : `http://${match}`
// })
markdown = !!markdown ? markdown.replace(urlRegex, (match) =>{
const hasProtocol = match.startsWith('https://') || match.startsWith('http://')
if (!hasProtocol) {
if (status.indexOf(`@${match}`) > -1) return match
}
return hasProtocol ? match : `http://${match}`
}) : undefined
if (status === markdown) {
markdown = undefined
}
const inReplyToId = getState().getIn(['compose', 'in_reply_to'], null) || replyToId
// console.log("markdown:", markdown)
dispatch(submitComposeRequest());
dispatch(closeModal());
@@ -706,9 +711,9 @@ export function changeScheduledAt(date) {
};
};
export function changeRichTextEditorControlsVisibility(status) {
export function changeRichTextEditorControlsVisibility(open) {
return {
type: COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY,
status: status,
open,
}
}
@@ -1,9 +1,9 @@
import escapeTextContentForBrowser from 'escape-html';
import emojify from '../../components/emoji/emoji';
import { unescapeHTML } from '../../utils/html';
import { expandSpoilers } from '../../initial_state';
import escapeTextContentForBrowser from 'escape-html'
import emojify from '../../components/emoji/emoji'
import { unescapeHTML } from '../../utils/html'
import { expandSpoilers } from '../../initial_state'
const domParser = new DOMParser();
const domParser = new DOMParser()
const makeEmojiMap = record => record.emojis.reduce((obj, emoji) => {
obj[`:${emoji.shortcode}:`] = emoji;
@@ -86,3 +86,21 @@ export function normalizePoll(poll) {
return normalPoll;
}
// <p><h1>attention!</h1></p>
// <p>#test @bob #nice https://bob.com http://techcrunch.com <del>strike it</del></p>
// <p><del>https://twitter.com</del></p>
// <p><em>@bobitalic</em></p>
// <p><pre><code>jonincode</code></pre></p>
// # attention!
// #test @bob #nice https://bob.com http://techcrunch.com ~~strike it~~
// ~~https://twitter.com~~
// _@bobitalic_
// ```
// jonincode
// ```