InDesign does not apply the paragraph styles correctly even when mapped to the same working paragraph styles - adobe-indesign

Was wondering if anyone knew why this may be happening? I've set up an InDesign document importing from Word with the correct formatting but then when I import the same document from Word with this time using the style mapping it doesn't retain and apply the styling.
I imported it - fixed all the necessary formatting issues and then made sure to save the paragraph styles for use later. I've then went back to the beginning and imported the word document again and this time used the customized style mapping to match the corresponding word styles with the now-correct InDesign styles. When I then place this document, however, it doesn't seem to retain the styling. Some styling does get transferred over but then some, such as indentation, does not.
This is it what it looks like on the correct document
Correct image
And then when I import it again with the styles mapped to the same styles they use it doesn't work.
Incorrect image
For example the sub heading is now numbered and indented wrong and the box on the left is now gone but it is the active applied style, with changes (I presume from the +?) If I then reapply it does work fine?
I'm not 100% sure why the paragraph style is there and works but does not seem to apply properly?

It can be fixed to a degree if you perform Find/Change for all your styles:
blank field with style --> blank field with the same style
for every single paragraph style.
It can be done manually, but since we're here I'd propose this script:
var doc = app.activeDocument;
var styles = doc.paragraphStyles;
var s = styles.length;
while (s--) {
app.findGrepPreferences.findWhat = '';
app.findGrepPreferences.appliedParagraphStyle = styles[s];
app.changeGrepPreferences.changeTo = '';
app.changeGrepPreferences.appliedParagraphStyle = styles[s];
doc.changeGrep();
}
app.findGrepPreferences = NothingEnum.nothing;
Probably the same is applied to character styles as well.

Related

ckeditor - Pure HTML source mode without ANY alterations of the code

I know this question has been asked 1000 times, but after 6 hours of research I still couldn't find any solution.
Unfortunately, I am bound to a CMS that's using ckeditor. I don't like WYSIWYG editors at all, but I have to deal with it. I want the editor to not touch ANY of my code, doesn't matter if it's wrong or not, if I place block elements into inline elements, etc.
This is the config I am using atm:
CKEDITOR.editorConfig = function( config ) {
config.language = 'en';
config.allowedContent = true;
config.height = 600;
config.startupMode = 'source';
// Prevent CK from removing empty HTML-tags
$.each(CKEDITOR.dtd.$removeEmpty, function (i, value) {
CKEDITOR.dtd.$removeEmpty[i] = false;
});};
Well, with these settings the editor still seems to alter the code. For instance, it realigns <a> or <span> tags and just adds new code. This is so incredible annoying. I know it's not the purpose of the editor to behave like a pure webdev editor, but there must be a way to configure it somehow to just leave the code completely alone, right? Can anyone tell me what settings I need to add in order to achieve this?
there must be a way to configure it somehow to just leave the code completely alone, right?
Wrong.
Libraries like this make use of the contentEditable feature provided by browsers.
The browser will take the HTML, parse it into a DOM, and then provide an API to manipulate it. Later, that DOM can be serialised back to HTML, but this is entirely disconnected from the original HTML. Everything will have been normalised.

How to disable pasting inline styles on CKEditor?

How do I disable contents for styles when pasting to CKEditor?
Overview, I'm trying to fix width styles on my DOMPdf, but inline styles pasted to CKEditor is messing up with the styles I've set up in DOMPdf.
I've applied what was posted here https://docs.ckeditor.com/#!/guide/dev_disallowed_content.
And so far, here's some of what I tried
CKEDITOR.config.disallowedContent = "table(width)",
CKEDITOR.config.disallowedContent = "table[style]"
But when I copy and paste from word docs or customized html strings, styles or width would still be pasted. Any tips? Thanks!
First of all if you want to remove the width style from the table, you need to use:
CKEDITOR.config.disallowedContent = 'table{width}';.
The rule CKEDITOR.config.disallowedContent = "table(width)" will remove the width class from the table and CKEDITOR.config.disallowedContent = "table[style]" will not do anything because styles are defined in {} and not in [].
Read more about the format of Allowed Content Rules here: https://docs.ckeditor.com/#!/guide/dev_allowed_content_rules
But when I copy and paste from word docs or customized html strings,
styles or width would still be pasted.
Please open the Full preset editor sample and try bolding the text or using some inline styles from the Styles dropdown. You will see tags like strong, code, big or span etc. are being used. In order to disallow them your ACF rule would need to look like so for example:
var editor = CKEDITOR.replace( 'editor1', {
disallowedContent : 'span;code;strong;big'
});
Please note that above rule disables span, strong, code and big tags completely in CKEditor. If you still wish to use these tags in the editor but filter content only during pasting, you should use paste events and regex to change the incoming HTML:
https://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-paste
https://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-afterPasteFromWord

CKeditor, colour of text seems to be not retained although HTML is correct, how to resolve?

I am using CKEditor 4.4.5.
Users use the text colour icon to change the colour of a word which works fine. When one checks the underlying HTML, it shows:
<p><span style="color:#FF0000">test </span></p>
However when clicks the "source" icon again to return to the standard non HTML view, the colouring has gone, although the underlying HTML is still correct. If you take this HTML and render it in a browser it will work correctly. So it seems that CKEditor is not able to render text colour correctly, unless freshly changed using the text colour icon.
We had customers thinking that the colour had not changed, and then trying to fix the issue in the HTML, which resulted in the total corruption of the HTML due to human error.
Is this a bug, or am I missing something?
Thanks.
As for CKEditor it might so happen that Advanced Content Filter will strip undesired tags / attributes.
If you don't have colorbutton plugin, CKEditor will strip this span (see standard demo).
You have 2 simple solutions:
Add colorbutton plugin.
Simply add to your config:
config.extraPlugins = 'colorbutton';
Add ACF proper rule.
config.extraAllowedContent = 'span{color}';
For more informations about ACF see Content Filtering (ACF).

How to change field value font styles in ServiceNow?

Is it possible to change field value font styles on OnLoad in servicenow ? I was able to change field label styles using below code.
// Custom field label colors
var stateLabel = g_form.getLabel('short_description');
stateLabel.style.color= 'red';
stateLabel.style.fontWeight='bold';
I tried to change field value font styles in similar way but no luck.
var stateValue = g_form.getValue('short_description');
stateValue.style.color= 'red';
stateValue.style.fontWeight='bold';
above code does not do any good , any thoughts on getting this to work?
Thanks in advance
The API call you're using g_form.getValue(...) is just going to return the string value of whatever field you're asking for.
To get access to the Element (like with getLabel) you can use g_form.getControl(...)
Example:
var el = g_form.getControl('short_description');
el.style.color = 'red';
el.style.fontWeight = 'bold';
However, I'd advise that instead of doing direct DOM manipulation with client-side javascript, that you use Field Styles instead:
Field styles allow administrators to declare individual CSS styles for
a field in a list or form. The CSS can:
Change the color.
Change the font attributes (bold, italics, underline).
Change the padding and alignment of text.
Field Styles allow you to specify a particular field, and apply arbitrary CSS.
To take it a step further, it even allows you to specify javascript to conditionally apply the Style based on something like the state of the record.
I would advise you to look at the VIP Callers on the Incident form, the field value color is sat to Red when the Caller.VIP = True
if this is your requirement, I would be happy to look it up for you.

Can I assign multiple values to the appliedCharacterStyle property of InDesign DOM's Text object?

I am working on an ExtendScript script which we use to prepare InDesign files for export to XHTML. Basically, we just go around applying character styles where we need them (have a look at this simplified example):
app.activeDocument.findGrep()[0].appliedCharacterStyle = "customStyle";
When we export the result to XHTML using InDesign's Export to XHTML feature, we get something like this:
<span class="customStyle">I</span>
which is exactly what we want. The problem arising now is that we sometimes want to apply many different styles to a single character, so we end up doing something like this:
var t = app.activeDocument.findGrep()[0];
t.appliedCharacterStyle = "customStyle1";
t.appliedCharacterStyle = "customStyle2";
Obviously, customStyle2 overrides customStyle1, which defeats the purpose. Is there any way around this?
Note: I tried using applyCharacterStyle instead, but that method doesn't take strings as parameter, only CharacterStyle objects.
Is "customStyle" just a css class or the name of a saved style? I don't really use inDesign so this is speculation but it looks like you could modify individual properties of the CharacterStyle object like
var myStyle = new CharacterStyle();
myStyle.fillColor = "blue";
myStyle.fontStyle = "verdana";
...
Or something then you should be able to apply it like this
t.applyCharacterStyle(myStyle);
This is just an educated guess based on my experience with extendscript and photoshop, Sorry if it's way off-base.

Resources