@ -4,10 +4,10 @@ import 'package:equatable/equatable.dart';
import ' package:quiver/core.dart ' ;
enum AttributeScope {
INLINE , / / refer to https: / / quilljs . com / docs / formats / # inline
BLOCK , / / refer to https: / / quilljs . com / docs / formats / # block
EMBEDS , / / refer to https: / / quilljs . com / docs / formats / # embeds
IGNORE , / / attributes that can be ignored
inline , / / refer to https: / / quilljs . com / docs / formats / # inline
block , / / refer to https: / / quilljs . com / docs / formats / # block
embeds , / / refer to https: / / quilljs . com / docs / formats / # embeds
ignore , / / attributes that can be ignored
}
class Attribute < T > extends Equatable {
@ -227,7 +227,7 @@ class Attribute<T> extends Equatable {
return IndentAttribute ( level: level ) ;
}
bool get isInline = > scope = = AttributeScope . INLINE ;
bool get isInline = > scope = = AttributeScope . inline ;
bool get isBlockExceptHeader = > blockKeysExceptHeader . contains ( key ) ;
@ -283,110 +283,110 @@ class Attribute<T> extends Equatable {
}
class BoldAttribute extends Attribute < bool > {
const BoldAttribute ( ) : super ( ' bold ' , AttributeScope . INLINE , true ) ;
const BoldAttribute ( ) : super ( ' bold ' , AttributeScope . inline , true ) ;
}
class ItalicAttribute extends Attribute < bool > {
const ItalicAttribute ( ) : super ( ' italic ' , AttributeScope . INLINE , true ) ;
const ItalicAttribute ( ) : super ( ' italic ' , AttributeScope . inline , true ) ;
}
class SmallAttribute extends Attribute < bool > {
const SmallAttribute ( ) : super ( ' small ' , AttributeScope . INLINE , true ) ;
const SmallAttribute ( ) : super ( ' small ' , AttributeScope . inline , true ) ;
}
class UnderlineAttribute extends Attribute < bool > {
const UnderlineAttribute ( ) : super ( ' underline ' , AttributeScope . INLINE , true ) ;
const UnderlineAttribute ( ) : super ( ' underline ' , AttributeScope . inline , true ) ;
}
class StrikeThroughAttribute extends Attribute < bool > {
const StrikeThroughAttribute ( ) : super ( ' strike ' , AttributeScope . INLINE , true ) ;
const StrikeThroughAttribute ( ) : super ( ' strike ' , AttributeScope . inline , true ) ;
}
class InlineCodeAttribute extends Attribute < bool > {
const InlineCodeAttribute ( ) : super ( ' code ' , AttributeScope . INLINE , true ) ;
const InlineCodeAttribute ( ) : super ( ' code ' , AttributeScope . inline , true ) ;
}
class FontAttribute extends Attribute < String ? > {
const FontAttribute ( String ? val ) : super ( ' font ' , AttributeScope . INLINE , val ) ;
const FontAttribute ( String ? val ) : super ( ' font ' , AttributeScope . inline , val ) ;
}
class SizeAttribute extends Attribute < String ? > {
const SizeAttribute ( String ? val ) : super ( ' size ' , AttributeScope . INLINE , val ) ;
const SizeAttribute ( String ? val ) : super ( ' size ' , AttributeScope . inline , val ) ;
}
class LinkAttribute extends Attribute < String ? > {
const LinkAttribute ( String ? val ) : super ( ' link ' , AttributeScope . INLINE , val ) ;
const LinkAttribute ( String ? val ) : super ( ' link ' , AttributeScope . inline , val ) ;
}
class ColorAttribute extends Attribute < String ? > {
const ColorAttribute ( String ? val )
: super ( ' color ' , AttributeScope . INLINE , val ) ;
: super ( ' color ' , AttributeScope . inline , val ) ;
}
class BackgroundAttribute extends Attribute < String ? > {
const BackgroundAttribute ( String ? val )
: super ( ' background ' , AttributeScope . INLINE , val ) ;
: super ( ' background ' , AttributeScope . inline , val ) ;
}
/ / / This is custom attribute for hint
class PlaceholderAttribute extends Attribute < bool > {
const PlaceholderAttribute ( )
: super ( ' placeholder ' , AttributeScope . INLINE , true ) ;
: super ( ' placeholder ' , AttributeScope . inline , true ) ;
}
class HeaderAttribute extends Attribute < int ? > {
const HeaderAttribute ( { int ? level } )
: super ( ' header ' , AttributeScope . BLOCK , level ) ;
: super ( ' header ' , AttributeScope . block , level ) ;
}
class IndentAttribute extends Attribute < int ? > {
const IndentAttribute ( { int ? level } )
: super ( ' indent ' , AttributeScope . BLOCK , level ) ;
: super ( ' indent ' , AttributeScope . block , level ) ;
}
class AlignAttribute extends Attribute < String ? > {
const AlignAttribute ( String ? val ) : super ( ' align ' , AttributeScope . BLOCK , val ) ;
const AlignAttribute ( String ? val ) : super ( ' align ' , AttributeScope . block , val ) ;
}
class ListAttribute extends Attribute < String ? > {
const ListAttribute ( String ? val ) : super ( ' list ' , AttributeScope . BLOCK , val ) ;
const ListAttribute ( String ? val ) : super ( ' list ' , AttributeScope . block , val ) ;
}
class CodeBlockAttribute extends Attribute < bool > {
const CodeBlockAttribute ( ) : super ( ' code-block ' , AttributeScope . BLOCK , true ) ;
const CodeBlockAttribute ( ) : super ( ' code-block ' , AttributeScope . block , true ) ;
}
class BlockQuoteAttribute extends Attribute < bool > {
const BlockQuoteAttribute ( ) : super ( ' blockquote ' , AttributeScope . BLOCK , true ) ;
const BlockQuoteAttribute ( ) : super ( ' blockquote ' , AttributeScope . block , true ) ;
}
class DirectionAttribute extends Attribute < String ? > {
const DirectionAttribute ( String ? val )
: super ( ' direction ' , AttributeScope . BLOCK , val ) ;
: super ( ' direction ' , AttributeScope . block , val ) ;
}
class WidthAttribute extends Attribute < String ? > {
const WidthAttribute ( String ? val )
: super ( ' width ' , AttributeScope . IGNORE , val ) ;
: super ( ' width ' , AttributeScope . ignore , val ) ;
}
class HeightAttribute extends Attribute < String ? > {
const HeightAttribute ( String ? val )
: super ( ' height ' , AttributeScope . IGNORE , val ) ;
: super ( ' height ' , AttributeScope . ignore , val ) ;
}
class StyleAttribute extends Attribute < String ? > {
const StyleAttribute ( String ? val )
: super ( ' style ' , AttributeScope . IGNORE , val ) ;
: super ( ' style ' , AttributeScope . ignore , val ) ;
}
class TokenAttribute extends Attribute < String > {
const TokenAttribute ( String val ) : super ( ' token ' , AttributeScope . IGNORE , val ) ;
const TokenAttribute ( String val ) : super ( ' token ' , AttributeScope . ignore , val ) ;
}
class ScriptAttribute extends Attribute < String ? > {
ScriptAttribute ( ScriptAttributes ? val )
: super ( ' script ' , AttributeScope . INLINE , val ? . value ) ;
: super ( ' script ' , AttributeScope . inline , val ? . value ) ;
}
enum ScriptAttributes {
@ -400,10 +400,10 @@ enum ScriptAttributes {
class ImageAttribute extends Attribute < String ? > {
const ImageAttribute ( String ? url )
: super ( ' image ' , AttributeScope . EMBEDS , url ) ;
: super ( ' image ' , AttributeScope . embeds , url ) ;
}
class VideoAttribute extends Attribute < String ? > {
const VideoAttribute ( String ? url )
: super ( ' video ' , AttributeScope . EMBEDS , url ) ;
: super ( ' video ' , AttributeScope . embeds , url ) ;
}