Adding Footnotes (or margin notes etc.) to The Quilljs Editor - quill

I'm looking for a way to add footnote / endnote functionality to the QuillJS.com editor. My requirements are that the note 'text' itself can still be edited as if it were document text -- hiding it away in an attribute is probably not going to work very well.
I wonder if this can be achieved?
To take a trivial example of a document:
Here is a document text as usual1
1This is the footnote text
My guess is that the best way to achieve this would be to:
Hold the actual note text as a series of blocks (note-text blocks) at the end of the document. Each block would need a unique name.
Insert the anchors (the numbers in the main text) as either some kind of embedded object or an inline blot of some kind.
When a new note is added, add the anchor inline, and add a new "note-text" block for that anchor at the end of the document, and move the cursor there.
Have some kind of mechanism to keep the order of the notes at the end of the document in sync with the order of the note-anchors in the main text.
Make sure that the block for the note text could only be deleted if its anchor was deleted. Conversely, if an anchor is deleted, remove the note-text block.
Clicking on the note-anchor would take the cursor to the note-text block, and clicking on the number at the start of the note-block (as rendered) would take the cursor back to the anchor.
Numbering would be determined by the order of the anchors in the document.
My question (for people who have experience of extending QuillJS) is: is such a system even possible? The only module that seems to come close to this level of functionality is the better-tables module.
I would really appreciate any insights about whether such a system could be achieved or some hints about how to do it.

Related

Where is the "mark occurrences" ("highlight selection") option/plugin?

When putting text cursor on a word I'd like other occurrences of this word to be highlighted.
I saw that it worked like that before. But how to enable it in the current version?
There is a highlight occurrences when selecting the whole word, but that's not enough.
The on-hover occurrence highlighting is a product of the semantic analysis backend.
Note that it doesn't highlight uses of a word, it highlights uses of a variable - i.e. the same name might exist in different scopes and their uses will be highlighted separately, uses in comments won't be marked, etc.
You should also notice that there's a tooltip when hovering over variables with type and other information, and that variable names are differently-coloured (unless you've set 'Local colourisation intensity' to zero in Configure Kdevelop -> Language Support).
If this isn't the case it probably means the semantic analysis backend isn't working -- either because the project settings aren't configured properly, or you lack the right plugin for the language you're using, or some dependency is missing.

AngularJS - highlight text of an existing pdf file in frontend/Browser

I have found the library
PDF creation
With this library it is possible to create different styles of pdf documents.
My question would be if there is a possibility to mark text (and maybe add a link to this marked text) of an existing pdf file with AngularJS?
Or is there any workaround to do this?
The question is a bit too broad as is - not sure what you mean by "mark" - do you mean highlighted in some way or actually selected?
Anyhow, firstly to get to the correct page -- you can use fragment identifiers in hyperlinks to link to a specific page in a PDF via the page parameter. e.g.
page 1
page 2
If you want to highlight a specific section of a page, via a hyperlink, you can use the highlight parameter, note you must also set the page to use the highlight parameter. e.g.
page 1 - highlight
The rectangle values are integers in a coordinate system where 0,0 represents the top left, and the values are given in the order lt, rt, top, btm.
One can also open a PDF file to a "Named Destination", that is a named section in the document via the nameddest parameter. e.g.
my section
This is great as it doesn't matter if pages are inserted, removed etc as the section will always be correctly linked.
You can read about Named Destinations here and also the various Parameters for Opening PDF Files

Grails 3 "show" view with Fields plugin 2.1.0-SNAPSHOT

Stuck at a trivial problem in Grails 3.1.5: Show the fields of a domain object, excluding one of them, including a transient property. Yes, this is my first Grails 3 project after many years with previous versions.
The generated show.gsp contains
<f:display bean="rfaPdffile"/>
This will include a field that may contain megabytes of XML. It should never be shown interactively. The display: false constraint is no longer in the docs, and seems to be silenty ignored.
Next I tried explicitly naming the fields:
<f:with bean="rfaPdffile">
<f:display property='fileName'/>
<f:display property='pageCount'/>
...
</f:with>
This version suprisingly displays the values without any markup whatsoever. Changing display to field,
<f:with bean="rfaPdffile">
<f:field property='fileName'/>
<f:field property='pageCount'/>
...
</f:with>
sort of works, but shows editable values. So does f:all.
In addition I tried adding other attributes to f:display: properties (like in f:table), except (like in f:all). I note in passing that those two attributes have different syntax for similar purposes.
In the Field plugin docs my use case is explicitly mentioned as a design goal. I must have missed something obvious.
My aim is to quickly throw together a prototype gui, postponing the details until later. Clues are greatly appreciated
If I understood you correctly, you want to have all bean properties included in the gsp but the one with the "megabytes of XML" should not be displayed to the user?
If that is the case you can do:
f:with bean="beanName"
f:field property="firstPropertyName"
f:field property="secondPropertyName"
And the one you don't wish to display:
g:hiddenField name="propertyName" value="${beanName.propertyName?}"
f:with
So list all the properties as f:field or f:display and put the one you don't wish to display in a g:hiddenField Grails tag
You can also try:
f:field property="propertyName"
widget-hidden="true"
but the Label is not hidden in this case.
Hope it helps
My own answer: "use the force, read the source". The f:display tag has two rather obvious bugs. I will submit a pull request as soon as I can.
Bugs aside, the documentation does not mention that the plugin may pick up the "scaffold" static property from the domain, if it has one. Its value should be a map. Its "exclude" key may define a list of property names (List of String) to be excluded. This probably works already for the "f:all" tag; bug correction is needed for the "f:display" tag.
My subjective impression is that the fields plugin is in a tight spot. It is intertwined with the Grails architecture, making it sensitive to changes in Grails internals. It is also required by the standard scaffolding plugin, making it very visible. Thus it needs constant attention from maintainers, a position not to be envied. Even now conventions for default constraints seem to have changed somewhere between Grails 3.0.9 and 3.1.7.
Performance of the fields plugin is sensitive to the total number of plugins in the app where it is used. It searches all plugins dynamically for templates.
For the wish list I would prefer stricter tag naming. The main tags should be verbs. There are two main actions, show and edit. For each action there are two main variants, single bean or multiple beans.
My answer is that at present (2 March 2017) there is no answer. I have searched the Net high and low. For the index (list) and create and edit views, the fields plugin works well enough. A certain field can be easily excluded from the create and edit views, relatively easily from the list view (by listing those that should show), and in no way I could find from the show view. This is such a common need that one would suspect it will be addressed soon. Also, easily showing derived values in the show view, like 'total' for an invoice. One can do that by adding an ordered list with a list item showing the value below the generated ordered list of values, but that is kind of a hack.
In some ways, the old way was easier. Yes, it generated long views, but they were generated and didn't have to be done by the programmer - just custom touches here and there.

Excel: apply conditional formatting if cell contains one of x strings

What I'm trying to do should be quite simple but I am getting error messages saying that conditional formatting doesn't accept this method.
So I am looking for a fix or an alternative.
What I have is a list of search texts for phone faults
screen broken
wifi not working
bluetooth dead
the dooflip isnt working
etc.
I have also set up a number of common keywords
screen
wifi
bluetooth
By comparing these two we can see that the last one doesn't adhere to any of my common keywords, and so I want it highlighted/ copied somewhere etc. so I can view and take any action.
So far I have attempted to set up conditional formatting to search the terms for the keywords and if it doesn't contain any then highlight it.
=ISERROR(SEARCH({"wifi", "bluetooth", "screen"},$H$117))
When using this I get informed that conditional formatting does not support arrays (it works fine if I only specify one search term).
If i create a table with all the keywords in and use the following it works, however it will only find direct mataches, and wont search for the word in the cell string
=ISERROR(MATCH(<cell_to_change_colour_of>, <keyword_table>,0))
So is there another way of doing this?
my answer requires MOREFUNC addon*
=REGEX.COMP(A1,"wifi|bluetooth|screen",FALSE)
this will return true if any of the words appear anywhere in cell A1. FALSE in the formula stipulates that it is not case sensitive.
Unfortunately due to Excell's stupid rules it will not work directly in Conditional Formatting box. You will need to place it in a helper column, and point the conditional formatting rule to that column.
MOREFUNC ADDON
Morefunc Addon is a free library of 66 new worksheet functions.
HERE is some information (by original author)
here is the last working download link I found
here is a good installation walk-through video

How to tag text, to keep track of unique edits

So, for example in database I have three users: Peter, John and Sara. There is a specific field, in which all three users can write.
Peter writes:
"I like apples"
, after that John appends with
" and I like bananas"
. Now I have field which says
"I like apples and I like bananas"
, so If I would like to display, which part was writen by whom, my approuch would be to create html tags:
The field would be:
<span class="text-sequence-1">I like apples</span><span class="text-sequence-2"> and I like bananas</span>
and then, from database I would pick the sentences by its order and using CSS on hover on display additional content, on each part of hover on.
1st problem. The problem is if, the third user, Sara, comes and
updates the text, which belongs to both original. Which can be
overcome if I allow to edit one by one Johns and Peters tags.
Then I get edited span inside of original spans and could track
which part was edited and how. If I did like this, I would still
face a second problem:
2nd problem. If Sara decides to edit, for example Johns part, a few
times. I would still get nested badly.
I could use something like #number tags instead of spans, so I can track where each edition ends, but then I couldn't apply CSS code to them to color which part belongs to who and apply additional effects on hover, like showing a box, who edited it and when.
Any ideas how could I implement it?
Sorry for my bad english.
Since you are using a database, keep track of the edits in a separate table. For each edit, keep the following fields:
row-ID of this edit (primary key)
the parent row-ID (the row-ID of the "current edit" when the edit was started/confirmed; see below for how to use)
the author that edited things
the time-stamp
an optional short text describing what was changed (for example, "fixed spelling")
When showing the field, you can then display a link to a "history", that would show who edited what when. You can show individual differences between any two versions such as Wikipedia does when you look at the history of a page - there are many libraries to do that, with highlighting and all. This library seems nice, but there are many others, in all sorts of languages.
When someone starts to edit, let them modify the then-current version (highest time-stamp). When they commit their edit (click accept or similar), check again to see that nobody else has changed things while they were editing (the time-stamp of the parent edit is still highest). If someone did change something, show them the difference between your parent-row and the edit, and tell them to fix things before committing (there may be several edits to take into account). This is the "wikipedia way", and it amounts to a sort of lightweight version control (much easier to implement than, say, Git)
Acually I think that this approach is not good. As you noticed you will get alot of nasty nestings.
What if somone edits only one letter?
Instead of that, think about line comparison approach. Like Git does. So compare if first line changed and store each version.( More sophisticated way would be only storing lines that changed and applying changes like git patches.)
I think your way is destined to fail. It's far way too complex and there is no logical comparision method to be used.
John is cool
John is uncool
John is Uncool
John is weak
Think how you would tag those. What if somone deletes piece of text? Edit will not be visible or u will insert an empty tag (which will not be visible)?
Dont tag, compare. Tagging is not what you're looking for i think. Also please see: Text comparison algorithm

Resources