Package com.atlassian.adf.model.mark
Class Breakout
- java.lang.Object
-
- com.atlassian.adf.model.mark.Breakout
-
- All Implemented Interfaces:
Element,Mark,CodeBlockMark,ExpandMark,LayoutSectionMark
@Immutable @Documentation(state=UNDOCUMENTED, date="2023-07-26") public class Breakout extends Object implements CodeBlockMark, ExpandMark, LayoutSectionMark
Thebreakoutmark sets block nodes to extend wider than the normal content area. When not present, elements fit within the narrower margins dictated by ADF's normal layout, as inspired by many modern websites likemedium.com. For some content, particularly technical content like code blocks, this can be too restrictive for comfortable viewing. Abreakoutmark sets wider margins for specific block node types where this is anticipated to be a concern.All this sounds very Confluence-specific, so this feature is probably not used or supported by other products.
The JSON schema currently gives the following reference points:
Example
Java
doc(p("Normal:"),codeBlock(LOREM_IPSUM),p("Full-width:"),codeBlock(LOREM_IPSUM) .fullWidth() )ADF
{ "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Normal:" } ] }, { "type": "codeBlock", "content": [ { "type": "text", "text": "Lorem ipsum ..." } ] } { "type": "paragraph", "content": [ { "type": "text", "text": "Full-width:" }, ] }, { "type": "codeBlock", "content": [ { "type": "text", "text": "Lorem ipsum ..." } ], "marks": [ { "type": "breakout", "attrs": { "mode": "full-width" } } ] } ] }Result
Normal:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Full-width:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBreakout.ModeSpecifies the desired width of content that breaks out of the usual content margins.-
Nested classes/interfaces inherited from interface com.atlassian.adf.model.Element
Element.Key
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Breakoutcopy()Returns a deep copy of this element, including copies of any nodes or marks that it contains.StringelementType()Thetypevalue that identifies this element, such as"paragraph"or"strong".static BreakoutfullWidth()booleanisSupported()Indicates whether this element is fully supported by this library.protected FieldMapmapWithType()Breakout.Modemode()Returns themodesetting for this breakout mark.Map<String,?>toMap()Transforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.StringtoString()voidvalidate()Verifies that the node is well-formed (including the state of any descendents that it has).static Breakoutwide()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.atlassian.adf.model.Element
isSupported, validate
-
-
-
-
Method Detail
-
copy
public Breakout copy()
Description copied from interface:ElementReturns a deep copy of this element, including copies of any nodes or marks that it contains. The copy will not necessarily be in exactly the same state as the original in some cases. For example, atextnode that is used inside acodeBlockwill have the ability to use marks on it disabled, but a copy made of the text node using this method will not similarly disallow marks unless it is also added to a content node with those same restrictions.Implementations notes:
- Implementations should narrow the return type.
- Implementations should
return thisif the element is immutable. The@Immutableannotation should be used on the class to offer additional confirmation of this intent. - Implementations should
return parse(toMap())if they have state. - While there may be cases where it is worthwhile to do something more efficient than
the conversion to a map and back, this is discouraged because it would add yet another
fragile piece of code that breaks when new data is added to the node. The
parseandtoMapmethods already have to be updated in these circumstances, so it makes sense to take advantage of that.
- Specified by:
copyin interfaceCodeBlockMark- Specified by:
copyin interfaceElement- Specified by:
copyin interfaceExpandMark- Specified by:
copyin interfaceLayoutSectionMark- Specified by:
copyin interfaceMark- Returns:
- a copy of this element, or
thisif the element is immutable anyway
-
wide
public static Breakout wide()
- Returns:
- a breakout mark indicating that a
widelayout should be used
-
fullWidth
public static Breakout fullWidth()
- Returns:
- a breakout mark indicating that a
full-widthlayout should be used
-
elementType
public String elementType()
Description copied from interface:ElementThetypevalue that identifies this element, such as"paragraph"or"strong".- Specified by:
elementTypein interfaceElement
-
mode
public Breakout.Mode mode()
Returns themodesetting for this breakout mark.
-
toMap
public Map<String,?> toMap()
Description copied from interface:ElementTransforms this element to a map ofStringvalues to various basic object types suitable for direct rendering as JSON content.
-
toString
public String toString()
-
mapWithType
protected FieldMap mapWithType()
-
isSupported
public boolean isSupported()
Description copied from interface:ElementIndicates whether this element is fully supported by this library. This library includes a small amount of support for preserving new, unrecognized node types during a round trip. These are represented by immutable placeholder objects that returnfalsefor this value.- Specified by:
isSupportedin interfaceElement- Returns:
truefor fully supported elements;falsefor immutable placeholders
-
-