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

feat: spellcheck in the description texteditor #2027

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
20326f6
feat: spellcheck in the description texteditor
DianaH583 Jul 18, 2024
9105f9b
automatic curation added to sample description
DianaH583 Jul 19, 2024
fc05f9a
moved curation to components and removed duplicate dictionaries
DianaH583 Jul 19, 2024
b64316f
started implamenting fetcher for automatic curation
DianaH583 Jul 19, 2024
bee95e1
admin fetch is now a set of 3 parallel requests
DianaH583 Jul 19, 2024
9006e1a
uploading a file replaces custom dictionary
DianaH583 Jul 19, 2024
9f85271
working on loading implantation
DianaH583 Jul 22, 2024
5b3e033
removed test buttons
DianaH583 Jul 22, 2024
fac2006
fixed issues with prompt not showing up in the right place
DianaH583 Jul 26, 2024
75ab349
working on affx application
DianaH583 Jul 30, 2024
5e513f5
admin, used dictionary to check custom dictionary
DianaH583 Jul 31, 2024
9acdb49
modified spellcheck to remove charactersbreaking it
DianaH583 Jul 31, 2024
df68c19
moved AC button inline with form header
DianaH583 Jul 31, 2024
d892439
admin: for dictionary updates search results when typing,
DianaH583 Aug 13, 2024
552be51
removed float from AC button to place it in order
DianaH583 Aug 13, 2024
a26d253
user: additonal info and purification AC implemented
DianaH583 Aug 13, 2024
ab6b067
User: AC model now updates if user changes description in quill editor
DianaH583 Aug 14, 2024
fd20647
solved hanging of suggestion recomendation for words with repeating c…
DianaH583 Aug 14, 2024
b878981
User: spellcheck now uses changed description
DianaH583 Aug 15, 2024
179da04
solved spell check getting confused with possesive nouns
DianaH583 Aug 23, 2024
378bb75
modifed how spellcheck handles mid word dashes
DianaH583 Aug 23, 2024
2c6f6fc
solved issue of regex not working if misspelled word is followed by p…
DianaH583 Aug 26, 2024
767b494
solved issue of description being earased when saved if no correction…
DianaH583 Aug 27, 2024
4266c09
moved dictionary object to state in AC
DianaH583 Aug 27, 2024
91355ec
words now remove highlight from already corrected words
DianaH583 Aug 27, 2024
501ab16
correct button is disabled until user selects a suggestion options
DianaH583 Aug 27, 2024
766f6f8
working on auto scroll to first mispelled word
DianaH583 Aug 27, 2024
f04ae24
now scrolls to currently selected word with the press of a button
DianaH583 Aug 28, 2024
e97b0ac
modal now scrolls to first detected mispelling on open
DianaH583 Aug 28, 2024
2e27ab2
Admin: added rough UI for batch curation
DianaH583 Sep 2, 2024
d6945c4
Admin: batch curation selection updates onExit of the modal
DianaH583 Sep 2, 2024
7bee5c7
soved issue of dictionary not updating due to reading from cache
DianaH583 Sep 5, 2024
0df2fff
began documention
DianaH583 Sep 9, 2024
5f3ce46
added documentation to CurationModal
DianaH583 Sep 10, 2024
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 app/api/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ def to_json_camel_case(val)
mount Chemotion::InventoryAPI
mount Chemotion::AdminDeviceAPI
mount Chemotion::AdminDeviceMetadataAPI
mount Chemotion::DictionaryAPI

if Rails.env.development?

add_swagger_documentation(info: {
title: 'Chemotion ELN',
version: '1.0',
Expand Down
53 changes: 53 additions & 0 deletions app/api/chemotion/dictionary_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# frozen_string_literal: true

module Chemotion
class DictionaryAPI < Grape::API
resource :dictionary do
desc "amend custom dictionary"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

namespace :amend do
params do
requires :new_word, type: String

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.

end
get do
file_path = "public/typojs/custom/custom.dic"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceAroundOperators: Operator = should be surrounded by a single space.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/ExtraSpacing: Unnecessary spacing detected.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

f = File.open(file_path, "a+")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

submitted_words = []
f.each {|dictionary_word| submitted_words.append(dictionary_word)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/MapIntoArray: Use map instead of each to map elements into an array.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideBlockBraces: Space between { and | missing.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideBlockBraces: Space missing inside }.

unless submitted_words.include?("#{params[:new_word]}\n")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/IfUnlessModifier: Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.

f.write( "#{params[:new_word]}\n")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideParens: Space inside parentheses detected.

end
f.close
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/BlockAlignment: end at 21, 4 is not aligned with namespace :amend do at 7, 6.


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

namespace :remove do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationConsistency: Inconsistent indentation detected.

desc "remove last entry"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

params do
requires :old_word, type: String
end
get do
file_path = "public/typojs/custom/custom.dic"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

last_line = 0
file = File.open(file_path, "r+")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

file.each {last_line = file.pos unless file.eof?}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideBlockBraces: Space missing inside {.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideBlockBraces: Space missing inside }.

file.seek(last_line, IO::SEEK_SET)
file.truncate(file.pos)
file.close
end
end

namespace :save do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationConsistency: Inconsistent indentation detected.

desc "admin save"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

params do
requires :new_dic, type: String

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationWidth: Use 2 (not 1) spaces for indentation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/ExtraSpacing: Unnecessary spacing detected.

end
get do
file_path = "public/typojs/custom/custom.dic"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

file = File.open(file_path, "w+")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

file.write(params[:new_dic])
file.close
end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/BlockAlignment: end at 51, 2 is not aligned with resource :dictionary do at 5, 4.

end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EndAlignment: end at 52, 0 is not aligned with class at 4, 2.

end
4 changes: 4 additions & 0 deletions app/assets/stylesheets/reaction.scss
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ table.reaction-scheme-solvent {
}
}

.inline-block-child {
display: inline-block;
}

.menu-outer-top .Select-menu-outer {
top: auto;
bottom: 35px !important;
Expand Down
14 changes: 14 additions & 0 deletions app/packs/src/apps/admin/AdminHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import TextTemplateContainer from 'src/apps/admin/textTemplates/TextTemplateCont
import DelayedJobs from 'src/apps/admin/DelayedJobs';
import ChemSpectraLayouts from 'src/apps/admin/ChemSpectraLayouts';
import DevicesList from 'src/apps/admin/devices/DevicesList';
import DictionaryCuration from 'src/apps/admin/AutomaticCuration'
// import TemplateManagement from 'src/apps/admin/TemplateManagement';

class AdminHome extends React.Component {
Expand Down Expand Up @@ -65,6 +66,8 @@ class AdminHome extends React.Component {
return this.renderDelayedJobs();
} else if (pageIndex === 14) {
return this.renderChemSpectraLayouts();
} else if (pageIndex === 15) {
return this.renderCurateDictionary();
}
return (<div />);
}
Expand All @@ -90,6 +93,7 @@ class AdminHome extends React.Component {
{/* <NavItem eventKey={12}>Report-template Management</NavItem> */}
<NavItem eventKey={13}>Delayed Jobs </NavItem>
<NavItem eventKey={14}>ChemSpectra Layouts </NavItem>
<NavItem eventKey={15}>Curate Custom Dictionary </NavItem>
</Nav>
</Col>
</div>
Expand Down Expand Up @@ -195,6 +199,16 @@ class AdminHome extends React.Component {
);
}

renderCurateDictionary(){
const { contentClassName } = this.state;
return (
<Col className={contentClassName} >
<DictionaryCuration />
</Col>
);
}


render() {
return (
<div>
Expand Down
Loading
Loading