Commit graph

53 commits

Author SHA1 Message Date
Suzanne Aitchison
5069cd681a
Markdown editor toolbar (#14876)
* rough starting point, roving tabindex in toolbar, bold and italic buttons

* refactor, add link

* add ul

* add ordered list

* core formatters in place, wip

* overflow options

* add keyboard shortcuts

* tidy up some dodgy classes

* add mocks for runtime in test and storybook, use correct modifier key for tooltip

* style tweaks

* refactor tooltips

* add markdown formatters tests

* add tests for toolbar component, fix mistake in overflow menu tooltips

* undo change no longer needed to button

* fix issue accessing runtime in formatters file

* only show darkened buttons and tooltips when focus-visible is true

* mobile view

* fix for responsive buttons & roving tabindex

* tweaks from PR review

* update cursor position on link insertion

* add a new line after block selection formatting

* align icons in center

* tidy up overflow menu listeners

* small refactors

* test for new text area util

* tidy up new lines after syntaxes

* fix logic in cursor offsets for links

* prevent scroll jumps after inserting syntax

* some style tweaks

* insert level 2 heading with new lines above and below

* update icons

* use margin instead of gap
2021-10-19 09:22:54 +01:00
Suzanne Aitchison
7a9352ba86
make default alt text 'image description' (#15063) 2021-10-13 16:37:34 +01:00
Julianna Tetreault
7e38db9afb
Resolve Errors Related to getUnopenedChannels.jsx (#14990) 2021-10-12 08:08:40 -04:00
Ben Halpern
036d75aa6e
Admin-configurable display locale (#14620)
* Admin-configurable display locale

* Add i18n-js and namespacing

* Basic tests and clean up

* A few test adjustments

* Update vendor cache

* Fix a few tests

* Fix a few tests

* Update app/views/articles/_actions.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_comments_actions.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_single_story.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_single_story.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/comments/_comment_header.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/layouts/_sidebar_tags.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/listings/index.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/system/homepage/user_visits_homepage_articles_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/system/user/view_user_index_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Alphabetical locale page

* Add activerecord custom validation error translations

* Add i18n to webpacker

* Fix a few tests

* Adjust error messages

* Add i18n-tasks

* Adjust JS to get working with jest

* Adjust the way translations are pulled in

* Adjust jest tests

* Remove time localization

* Remove superfluous public js

* Add basic tests for i18n application controller

* Remove unnecessary content

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-09-28 11:04:35 -04:00
Ridhwana
9d16aa0166
chcek if the element exists before calling onclick on it (#14785) 2021-09-21 18:34:49 +02:00
Nikhil Taneja
ff008e4702
#12643 Add eslint rule for formatting redundant curly braces in jsx (#14592) 2021-08-26 11:15:06 -04:00
Suzanne Aitchison
86e4c39e31
Make sure open preview cards don't collapse on scroll (#14482)
* don't close dropdown on scroll if already open

* fix minor alignment issue with author comments
2021-08-12 13:29:51 +01:00
Suzanne Aitchison
5efd72040b
change preview card dropdown position depending on viewport (#14473) 2021-08-11 18:40:11 +01:00
Nick Taylor
96f54d02cd
[15 min fix] Fixed an issue with the moderation button not appearing on some posts (#14184)
* Fixed an issue with the moderation button not appearing on some posts.

* Added some E2E tests to ensure moderation button is on posts for trusted users.

* Added some more tests.

* Added a test to ensure moderation button does not appear when logged out.
2021-07-13 10:31:00 +02:00
Suzanne Aitchison
f8e56b356e
create definite handles to listeners in initialize function (#14033) 2021-06-23 15:09:03 +01:00
Suzanne Aitchison
546e64a029
Always show preview card on hover (#14032)
* always show preview on hover

* avoid use of important
2021-06-22 15:56:07 +01:00
Suzanne Aitchison
af517bc5aa
Optimise dropdowns for accessibility: Preact component usages (#13948)
* use the dropdown initializer in post editor options

* use dropdown initializer in comment subs dropdown

* use Dropdown component in listings

* show the dropdown button when it's focused

* update storybook notes and components

* add cypress tests for post options dropdown

* add comment subscription tests

* make sure page is properly initialized before setting button functionality

* add jsdoc comments, props types, rely on optional chaining

* Update app/javascript/crayons/Dropdown/__stories__/dropdowns.md

Co-authored-by: rhymes <github@rhymes.dev>

* Update app/javascript/crayons/Dropdown/__stories__/dropdowns.md

Co-authored-by: rhymes <github@rhymes.dev>

Co-authored-by: rhymes <github@rhymes.dev>
2021-06-15 12:06:27 +01:00
Suzanne Aitchison
e0798b88e0
Message context menu in connect is not accessible #12250 (#13806)
* make connect message dropdown accessible

* add a cypress test

* use crayons buttons throughout

* fix some unhandled error affecting cypress

* make message options a list

* minor tweak to test

* guard against filter error being triggered in test

* utilise newer dropdown helpers

* wait for message to fully send

* use optional chaining
2021-06-15 11:13:31 +01:00
Julien Maury
a2677cc0a9
Remove defer attributes from inline scripts - gist embeds (#13407)
* replace inline attribute defer with external js - show.html.erb

* fix typo in filename

* disable no-undef and bail if not defined

* put js on subfolder utilities

* refactor jsx instead of loading chunk with defer

* fix typo in desc

* better name for global gist helper

* use InstantClick

* working script on preview AND single view, not dynamic import, though

* embed only if gists

* combine all approaches to make dynamic import work

* make gist embeds work on submit comment form

* make gist embeds work on preview comment

* refactor - preview comments and submit

* add pack editComment + helper embedGistsInComments

* comment gist helper

* delete useless file utility

* use new syntax for events

* put code in method embedGistsInComments

* delete older pack gist

* handle edge case 'view full discussion'

* resolve conflict with package ibm-openapi-validator

* resolve conflict with package husky

* empty commit to test random error travis

* better name for class dismiss

* handle future events submit

* delete test code on click toggle form

* delete unused file

* rename pack as js file, not jsx

* Added POC using MutationObserver.

* missing case: notification page

* use custom pack notification page

* add e2e test for comment with embed gist

* add e2e test for preview post with embed gist

* add an extra step in tests to check gist is present

Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-11 08:22:50 +01:00
Suzanne Aitchison
be15f31122
Optimise dropdowns for accessibility: Dashboard and Manage pages (#13909)
* use dropdownutils in dashboard and manage pages

* add tests for the toggle menu on dashboard

* add test for archiving from manage post view

* small tweak to avoid unhandled errors

* small tweaks to form methods
2021-06-04 10:19:56 +01:00
Suzanne Aitchison
573c78d032
Advise users about potential accessibility failings in their posts - RFC #58 (#13745)
* initial rough version

* link to relevant rules, extract image text, only show if more than 0 errors

* jsdoc and tweaks

* refactors

* add tests

* open info links in new tab

* add new window link icon
2021-06-03 10:27:12 +01:00
Suzanne Aitchison
7e322e4f7b
Optimise dropdowns for accessibility - Post comments and share (#13868)
* WIP - basic init of comment dropdowns with open and close on click

* WIP - initialize the share dropdown

* initialize all post dropdowns within packs, init copy to clipboard announcer

* refactor and add JSDocs to helper

* undo changes to base jsx

* update accessible name of post actions button in cypress test

* make sure dropdowns pack loaded on comment index page

* undo prettier changes in base jsx

* undo prettier changes in base jsx

* initialize comment dropdowns in podcasts

* add test for the post actions

* add article comment tests

* add cypress tests for comment dropdowns
2021-06-03 09:13:17 +01:00
Andrew Bone
59c7e25e22
Remove input scroll from position (#13569)
* Remove input scroll from position

* Rerun travis
2021-04-29 11:00:37 +02:00
Hariharan Sampath
208d788672
Fix feed navigation shortcuts when first article is not 100% visible (#11874)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Hariharan <hariharan.s@samsung.com>
2021-04-13 22:35:50 -04:00
Suzanne Aitchison
458e3fbc7a
make sure all text area heights stay in step (#13341) 2021-04-12 10:34:21 +01:00
Suzanne Aitchison
aa22266e9d
[15 min fix] Allow resize hook to contrain max-height as well as min (#13269)
* allow resize hook to contrain max-height as well as min

* trigger checks
2021-04-06 12:11:03 +01:00
Suzanne Aitchison
6f057fc8ce
Add mention autocomplete to posts (#13101)
* WIP - initial exploration into post mentioon autocomplete

* replace the autosize textarea with mention autocomplete, adjusting height

* add cypress tests for mentioning in a post

* fix resizing of text areas

* refactor text area resize hook

* refactoring

* update cypress tests

* remove mergeRefs from utils, extract UserListItemContent

* allow useTextAreaAutoResize elements to have height greater than minimum, apply styles to container

* Trigger Travis CI

* Travis plz

* small refactors

* add comments and constants as per PR feedback

Co-authored-by: Nick Taylor <nick@dev.to>
2021-03-31 14:42:59 +01:00
Suzanne Aitchison
45a291047d
Re-add mention autocomplete to comments, fixing bugs (#13126)
* Revert "Revert "Add (updated) mention autocomplete to post comments (#13061)" (#13116)"

This reverts commit e28bde043c.

* Fix issues with editing comments and arrow key navigation, update tests

* Update app/javascript/crayons/MentionAutocompleteTextArea/MentionAutocompleteTextArea.jsx

Co-authored-by: Nick Taylor <nick@forem.com>

* refactor adding of attributes

* destructure

Co-authored-by: Nick Taylor <nick@forem.com>
2021-03-26 13:43:05 +00:00
Nick Taylor
e28bde043c
Revert "Add (updated) mention autocomplete to post comments (#13061)" (#13116)
This reverts commit a23caead07.
2021-03-25 10:33:51 -04:00
Nick Taylor
0beacb19c9
[15 Minute Fix] Added the prefer-const eslint rule (#13098) 2021-03-23 16:29:56 -04:00
Suzanne Aitchison
a23caead07
Add (updated) mention autocomplete to post comments (#13061)
* add mention autocomplete functionality to article and notification comments

* add cypress tests

* make sure entry transitions dont replay

* undo change to async useeffect covered in other pr

* move search into dynamic import

* exit search if enter pressed in middle of search term

* refactor button activation code

* add a space after a mention is selected

* tweak cypress test for reply to ensure it awaits combobox

* small refactor
2021-03-22 09:18:13 +00:00
Suzanne Aitchison
e3c97d18d6
Update storybook mention autocomplete component to take over whole textarea (#13044)
* Revert "Revert "Update storybook autocomplete component (#12980)" (#13027)"

This reverts commit f393dd2bbc.

* create helper function to replace node, add comments

* minor refactors
2021-03-18 15:04:59 +00:00
Nick Taylor
f393dd2bbc
Revert "Update storybook autocomplete component (#12980)" (#13027) 2021-03-17 15:59:38 -04:00
Suzanne Aitchison
76a7ed6dbe
Update storybook autocomplete component (#12980) 2021-03-17 11:49:16 -04:00
Suzanne Aitchison
494d92d74c
Create mention autocomplete: initial storybook component (#12831)
* initial setup of component

* initial styles applied

* add some initial docs

* small tweaks to story

* add some very initial tests

* tweaks to styles to add border bottom

* add some preact tests

* import default style in jsx, ignore in jest

* WIP - create MentionAutocompleteListener, attempt to position popover

* position dropdown correctly, exit selection in various scenarios

* refactor

* make sure cursor placed correctly after selection

* only import autocomplete when needed

* rename files, add jsdoc

* update tests and story notes

* tidy up scss file

* fix story styling

* fix aria label in story

* fix issue with key event not triggering in mobile

* position dropdown at input left if small screen

* fix issue with deleting and re-entering

* don't trigger search if directly following a letter or number

* stop change event being fired with highihted text

* move regex out of function into constant
2021-03-05 13:18:26 +00:00
Andrew Bone
9ef1534d83
Add paste image (#10212)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-02-04 10:58:56 -05:00
Katie Davis
76453b41fb
Updates ESLint rules to error on default imports (#12512)
* add rule

* add named imports

* more missed files

* so many files
2021-02-02 10:24:03 -05:00
Nick Taylor
df31a94f2e
Prep work to sync mobile search in #10424 (#11525)
* Prep work to sync mobile search in #10424

* Added a comment about the custom search event.

* Refactor to fix already defined error caused by const and InstantClick.

* Moved <SearchFormSync /> out of the pack file.

* Fixed broken tests.

* Renamed getInitialSearchTerm utility function to getSearchTermFromUrl

* Added some API docs to getSearchTermFromUrl

* Fixed a typo.

* Added some more API docs.

* Switched to a custom event so a custom payload can be passed.

* Added some API docs.

* Fixed bad destructuring statement.

* wip for some more tests.

* Refactored getSearchTermFromUrl to use URLSearchParams

* lazy loaded state for search term initial value.

* test broken still. Need to think on it.

* filterXSS is now set up in testSetup.js

* Fixed tests.

* Added the @utilities alias to Storybooks webpack config.

* Almost 100% coverage with two useful tests.

* Added some comments explaining document.body usage in the tests.

* Fixed issue where search attemps to get results on first load.

* Small refactor for setting the window.location in tests.

* Clarified an explanation in a comment.
2020-11-30 06:13:06 -05:00
Nick Taylor
d623157eee
Fixed some frontend tests causing unhandled rejection errors (#11627)
* Fixed unhandled rejection in <ImageUploader /> test.

* Fixed <FollowUsers /> tests.

* Fixed the tests for the <RequestManager /> component.

* Fixed unhandled rejection in search utilities.

* Added an unhandledRejection listener so tests will fail if a Promise fails.

* Added a comment about why you might get an unhandled rejection exception.
2020-11-26 06:11:25 -05:00
Nick Taylor
bf7780cd2c
Ran prettier on *.js, *.jsx and *.md files. (#11586) 2020-11-23 20:45:50 -05:00
rhymes
f9506affb5
Use faster JS selection methods (#11409)
* Add JS tips section to frontend documentation

* Replace document.getElementsByTagName('body') with document.body

* Replace querySelectorAll with faster selecting methods where appropriate

* Replace querySelector with faster selecting methods where appropriate

* Fix typo

* Fix forEach and getElementsByClassName

* Change querySelector* to faster methods in erb files

* Change querySelector* to faster methods in ruby files

* Fix runkit tag

* Various fixes

* Update app/assets/javascripts/initializers/initializeEllipsisMenu.js

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Update app/assets/javascripts/utilities/slideSidebar.js

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Commenting out flaky spec

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2020-11-16 17:35:50 +01:00
Robin Gagnon
27a3df7d73
A11y: Add keyboard navigation to article feed (#10468)
Co-authored-by: Andrew Bone <AndrewB05@gmail.com>
Co-authored-by: Nick Taylor <nick@dev.to>
2020-11-10 22:38:15 -05:00
Sarthak Sharma
708791f986
🚀 Feature: Give Tab Notification on New Message (#9847)
Co-authored-by: Narender Singh <narender2031@gmail.com>
2020-11-04 16:34:01 -05:00
Mac Siri
8ba2c03360
[deploy] Encode domain name in pusher channels (#11136)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2020-10-28 14:52:38 -04:00
Nick Taylor
82d659be8f
Fix Search Navigation Disconnect Between URL and Search Input (#11009) 2020-10-22 12:37:26 -04:00
Ivan
4f79da26c3
add fullscreen to code blocks (#10784)
* add fullscreen to code blocks

* add review fixes

* remove extra import

* fix approved tests

* code review - paddings

* fix padding to make highlight code scrollable
within  padded area

* add fullscreen to existing webpack entrypoint

* fixed aria: true generated extra ids

* fix tests
2020-10-14 12:01:35 +02:00
Sarthak Sharma
83b3baeac3
[deploy] 🚀 Feature: Draw Command for connect with image annotations (#10136)
* 🚀 Draw Command ready for connect [Rebase]

* revert schema changes

* fix & replace Button with theme button

* fix UI

* add test cases

* fix travis issue

* on image upload enable send button

* revert schema.db changes

* revert UI changes

* fix suggestions

* Update app/javascript/chat/draw/index.jsx

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* update test cases

* remove commented code

* Trigger Travis CI

Co-authored-by: Narender Singh <narender2031@gmail.com>
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2020-10-07 16:06:22 +02:00
Drew Bragg
1fa54e33c2
Return if receive own message (#10618) 2020-10-06 14:33:29 -04:00
Nick Taylor
f0963c1bfa
Drag and drop an image in the editor (#10145)
* Refactored drag n drop functionality to a hook and component.

* Add the snackbar to the article editor.

* Now you can drag and drop images in the post body content.

* Cleaning up a few things.

* Now post cover images can be dragged and dropped.

* Removed unused empty function.

* Added @testing-library/preact-hooks so that we can test hooks.

* Some renaming, small refactor.

* Added tests

* Added more tests.

* Added more tests.

* Added message about dropping only one image in post body.

* Added message about dropping only one image for cover image.

* put onDrop into it's own meethod.

* More tests.

* Added some API documentation.

* Updated editor help with drag and drop image help.

* Changed wording.

* Now the alt text for markdown removes the file extension.

* Updated help wording. Thanks @rhymes

* Now the image markdown adds a new line at the end as we currently do not support inline images.
2020-09-04 14:12:59 -04:00
Sarthak Sharma
b26b031616
🚀 Feature: Ability to upload images to connect by drag and drop (#9992) 2020-08-31 14:14:32 -04:00
Ben Halpern
e41a4f8968
[deploy] Include APP_NAME in Pusher channels (#10001)
* Backgend adjustments

* Fix keys

* Fix key

* Adjust style

* Fix typos

* Fix typo

* Refactor

* Fix syntax error
2020-08-31 08:28:46 -04:00
Fernando Valverde
9da71a47c7
[deploy] Introduces Runtime class for standardized & other native cleanup + replace podcast GA with ahoy (#10026) 2020-08-28 05:52:04 -06:00
Sarthak Sharma
3addb64326
[deploy] 🚀 Feature: Chat channel membership manager component (#8945)
* Feature 🚀 : Ability to delete messages in chat channels

- Sending message ID to frontend
- Deleting Message
- Use pusher to delete message realtime

* Minor Bug 🐞: Show message action only for current user

- User can delete or edit their own messages

* Test cases added

* Bug 🐞: Update message id for receiver

Message id was not sent to receiver by pusher

* Refactoring🛠: Message controller refactoring

* Test Cases📝 : Specs for Delete message added

* Feature 🚀 : Ability to edit messages

* Test Cases📝 : Specs for Edit message added

* Merge conflict resolved

* fix video content issue

* add UI for membership management

* add api to update memberahip role

* add methods for manage membership

* Add integration test cases

* add emoji for admin

* Open member profile in sidecar only

* 🐞 Problem with direct channel sidecar

* 🐞 Few other UI enhancements

* fix mod typo

* add limit upto 4 for display active memberships

* fix UI issues

* fix action ui for membership

* fix sidebar redirection issue

* fix svg buttons

* add test cases

* fixed broken spec

* fix PR suggestions

* remove not used code

* fix typo

* fix PR suggestion

* fix typos

* add invitation url expiry

* fix specs

* fix PR suggestions

* removed unused gem

* remove presenter format

* handle invitation link expiry with redis

* fix PR suggestions

* user can view non-discoverable channel invitation link

* fix typos

* remove commented code

* add spacing

* PR suggestions

* remove class from button

* replace componentDidMount with commen function

* remove action button for single membership

* add chat message on update role

* add spece between lines

Co-authored-by: Narender Singh <narender2031@gmail.com>
Co-authored-by: Fernando Valverde <fdov88@gmail.com>
2020-07-20 08:08:31 -04:00
Nick Taylor
30bfe1adfd
More frontend lint fixes (#8931) 2020-06-29 08:19:13 -04:00
Dana Scheider
f6a4c844cd
Implement chronological sorting of search results (#8193)
* Implement search ordering by allowing sort_by and sort_direction
params to be passed through from the search form/page.

* Change ID of select to 'sort' instead of 'order' for consistency

* Fix styling and data attributes of select options

* Enable front end to pass sort_by and sort_direction params for searches to the back end

* Ensure that only query string params that are supposed to be changed are changed in each function

* Respond to review comments (additional commits to come but these were the quick changes)

* Move options for select into template

* Use addEventListener instead of using onchange in response to review comments

* Add tabs for sorting search results

* Finish implementing tabs for ordering search results

* Remove CSS rule applying to element that no longer exists

* Remove more rules created for an element that has been removed

* Remove more code added for the select dropdown that I've removed

* Remove duplicate jobs banner
2020-06-11 13:11:01 +02:00