Continue formatting from old paragraph in new paragraph - ckeditor

In the CkEditor5 Classic Editor, if you type a paragraph, format that paragraph (for example, setting font-size and font-family), then start a new paragraph, the new paragraph won't have the formatting of the preceding paragraph applied to it.
How can I change this?

Related

Footnotes created via script appear in a strange location

I'm writing a script to handle some layout and I've come across some odd behaviour when creating footnotes.
Whenever I create the footnotes with the script, they appear before the next paragraph which is of a different style to the paragraph containing the footnote. Unless it reaches the end of the story in which case they will appear at the bottom of the page.
I would like for it to behave the same way as when you insert a footnote via the menu, I.E. placing the footnotes together at the bottom of the page.
Here's a before and after:
Here's the relevant code which creates the footnotes. references is an array containing the superscript references in the text (as a character or range of character objects). footnotes is an array containing the footnotes between the #FootnoteB and #FootnoteE tags as paragraph objects.
for (var i = 0; i < references.length; i++) {
// Create footnote
newFootnote = textPara.parentStory.footnotes.add(LocationOptions.BEFORE, references[i].insertionPoints[0]);
// Move footnote text into the footnote
footnotes[i].move(LocationOptions.AFTER, newFootnote.insertionPoints[-1]);
// Remove \r at the end of the footnote
newFootnote.characters.item(-1).remove();
// Delete the leftover superscript reference
references[i].remove();
}
It seems to make no difference where I add the footnotes, whether I add them to the paragraph, story or text frame, the result is the same.
I would check the paragraph styles that appear after the footnotes for their ParagraphStyle.spanColumnType value. I'm not sure if it's a bug or a feature, but if your paragraph spans columns the footnote will appear above it (as if it were the beginning of a new column).
Through the UI, you can check this by editing the paragraph style and checking its Span Columns tab.
ETA: the values you would want in order to avoid the footnote placement you have now are SpanColumnTypeOptions.SINGLE_COLUMN or, via the UI, just Single Column.

How do you make a bullet point with a double bullet character in InDesign?

I have a bulleted list in InDesign but I want the bullet character to be shown twice.
I'm using the / character, so I want it to appear like // like a comment. I can't figure it out. I have the bullet a different colour/style as the text following it, so I don't want to "hard-code" it in either.
Sorry for the trolls fellow. Your question isn't a programming question, which is why you got a downvote.
However, to help you out, try using a font for your bullet point that has a glyph that you like - you can use any character for the bullets, you know.
Or, if you create a new paragraph style, you can go into the Paragraph Style Options under Bullets and Numbering. Now, where it says Text After you can enter another bullet character there. But you'll have to also create a character style to set it to the right font to show your bullet character.

NSTextView paragraph style of newline

I've been playing around with NSTextView and have applied some paragraph styles to certain lines. However, when I type enter and get a new line, the attributes that I applied to one line are bleeding into the next.
I want to be able to apply a paragraph style to one line and have the next line be formatted in the default way. You can see what I mean from the screenshots.
When I add some spacing between paragraphs via NSParagraphStyle, the same spacing applies to the newline, which makes the whole thing look pretty shotty. Basically, I am looking for a way to reset the paragraph style for an empty line.
I have tried [MyTextView resetTypingAttributes:theAttributes] to no avail, since you first have to start typing for the new attributes to apply. Just to be clear, the line below the text in the screenshot is the cursor, which is really far down there as a result of the paragraph spacing.
Screenshot:
It seems that you have to use setTypingAttributes on the textview.

How is a paragraph defined in an NSAttributedString?

I see that there is an attribute name (NSParagraphStyleAttributeName) for applying paragraph styles to text in Cocoa. Text is stored in an NSAttributedString, but what defines a "paragraph" in that string -- is it the newline character \n? Other characters? If it's a \n, then how do you create a new line without starting a new paragraph. And lastly, when you attach a ParagraphStyle to the string, do you have to use the exact range of the whole paragraph, or can you put it on any sub-range in the paragraph. If it can be a sub-range, how does the system handle two or more ParagraphStyles on the same paragraph?
thanks,
Rob
I got an answer from Douglas on Apple's cocoa-dev mailing list:
http://lists.apple.com/archives/Cocoa-dev/2010/Dec/msg00347.html
I'll copy what he wrote here:
Any of the standard paragraph separators can be used (\n, \r, \r\n, Unicode paragraph separator). Use the Unicode line separator character to start a new line without a paragraph break. It is best to apply a paragraph style to an entire paragraph; if that is not done, then the paragraph style attribute will be automatically fixed at attribute fixing time so that it is constant over each paragraph range, because that is needed at layout time.
It might be worth mentioning that Apple's String Programming Guide has a section on Paragraph and Line Breaks, and that NSString will give you the paragraph ranges without your having to search for paragraph separators.
the best way in iOS from my experience is to use
#"\n\r";
i found inconsistent behaviour with just using \n or even 0x2029 (which should be the equivalent of NSParagraphSeparatorCharacter (not defined in iOS))
the problems emerged when using NSAttributedString and NSParagraphStyle... as when using the #"\n" or (0x2029) the setParagraphSpacing was ignored by other than the first paragraph... using #"\n\r" got the paragraphes right

Placing paragraphs within text fields or labels

How do I place a small paragraph within a text field or label? Do I use code for the new line? I'm using Interface Builder with Xcode.
You could also try using an Text View (NSTextView/UITextView) instead of a text field or a label.
You must mean more than one paragraph, because a single paragraph doesn't need a new line. Just copy it out of a text editor and paste it in.

Resources