Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add markdown and html support - Issue/341 #385

Merged
merged 5 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ gem 'ecko-plugins', '~> 0.1.6'
gem 'ecko-plugins-stripe', '~> 0.1.0'
gem 'ecko-plugins-sponsor', '~> 0.1.0'

gem 'redcarpet', '~> 3.5'

gem 'json-ld'
gem 'json-ld-preloaded', '~> 3.1'
gem 'rdf-normalize', '~> 0.4'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ GEM
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.4.0)
rdf (~> 3.1)
redcarpet (3.5.1)
redis (4.4.0)
redis-namespace (1.8.1)
redis (>= 3.0.4)
Expand Down Expand Up @@ -813,6 +814,7 @@ DEPENDENCIES
rails-i18n (~> 6.0)
rails-settings-cached (~> 0.6)
rdf-normalize (~> 0.4)
redcarpet (~> 3.5)
redis (~> 4.4)
redis-namespace (~> 1.8)
rqrcode (~> 2.1)
Expand Down Expand Up @@ -845,3 +847,4 @@ DEPENDENCIES
webpacker (~> 5.4)
webpush (~> 0.3)
xorcist (~> 1.1)

2 changes: 2 additions & 0 deletions app/controllers/api/v1/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def create
application: doorkeeper_token.application,
poll: status_params[:poll],
idempotency: request.headers['Idempotency-Key'],
content_type: status_params[:content_type],
with_rate_limit: true,
local_only: status_params[:local_only])

Expand Down Expand Up @@ -87,6 +88,7 @@ def status_params
:visibility,
:scheduled_at,
:local_only,
:content_type,
media_ids: [],
poll: [
:multiple,
Expand Down
9 changes: 9 additions & 0 deletions app/javascript/mastodon/actions/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS';
export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL';
export const COMPOSE_UPLOAD_PROGRESS = 'COMPOSE_UPLOAD_PROGRESS';
export const COMPOSE_UPLOAD_UNDO = 'COMPOSE_UPLOAD_UNDO';
export const COMPOSE_CONTENT_TYPE_CHANGE = 'COMPOSE_CONTENT_TYPE_CHANGE';

export const THUMBNAIL_UPLOAD_REQUEST = 'THUMBNAIL_UPLOAD_REQUEST';
export const THUMBNAIL_UPLOAD_SUCCESS = 'THUMBNAIL_UPLOAD_SUCCESS';
Expand Down Expand Up @@ -156,6 +157,7 @@ export function submitCompose(routerHistory) {
visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null),
local_only: !getState().getIn(['compose', 'federation']),
content_type: getState().getIn(['compose', 'content_type']),
}, {
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
Expand Down Expand Up @@ -341,6 +343,13 @@ export function onChangeMediaFocus(focusX, focusY) {
};
};

export function changeComposeContentType(value) {
return {
type: COMPOSE_CONTENT_TYPE_CHANGE,
value,
};
};

export function changeUploadCompose(id, params) {
return (dispatch, getState) => {
dispatch(changeUploadComposeRequest());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import UploadButtonContainer from '../containers/upload_button_container';
import { defineMessages, injectIntl } from 'react-intl';
import SpoilerButtonContainer from '../containers/spoiler_button_container';
import PrivacyDropdownContainer from '../containers/privacy_dropdown_container';
import ContentTypeContainer from '../containers/content_type_container';
import FederationDropdownContainer from '../containers/federation_dropdown_container';
import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container';
import PollFormContainer from '../containers/poll_form_container';
Expand Down Expand Up @@ -256,6 +257,7 @@ class ComposeForm extends ImmutablePureComponent {
<UploadButtonContainer />
<PollButtonContainer />
<PrivacyDropdownContainer />
<ContentTypeContainer />
<SpoilerButtonContainer />
<FederationDropdownContainer />
</div>
Expand Down
Loading