Skip to content

Commit 0df1dac

Browse files
committed
removed Container from Attributes.dart
1 parent 105024d commit 0df1dac

File tree

2 files changed

+4
-52
lines changed

2 files changed

+4
-52
lines changed

packages/notus/lib/src/convert/html.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ class _NotusHTMLEncoder extends Converter<Delta, String> {
283283
_writeBlockTag(buffer, attribute, close: close);
284284
} else if (attribute.key == NotusAttribute.embed.key) {
285285
_writeEmbedTag(buffer, attribute, close: close);
286-
} else if (attribute.key == NotusAttribute.container.key) {
287-
// do nothing
288286
} else {
289287
throw new ArgumentError('Cannot handle $attribute');
290288
}

packages/notus/lib/src/document/attributes.dart

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ abstract class NotusAttributeBuilder<T> implements NotusAttributeKey<T> {
4040

4141
final String key;
4242
final NotusAttributeScope scope;
43+
4344
NotusAttribute<T> get unset => NotusAttribute<T>._(key, scope, null);
4445
NotusAttribute<T> withValue(T value) =>
4546
NotusAttribute<T>._(key, scope, value);
@@ -77,7 +78,6 @@ class NotusAttribute<T> implements NotusAttributeBuilder<T> {
7778
NotusAttribute.heading.key: NotusAttribute.heading,
7879
NotusAttribute.block.key: NotusAttribute.block,
7980
NotusAttribute.embed.key: NotusAttribute.embed,
80-
NotusAttribute.container.key: NotusAttribute.container,
8181
};
8282

8383
// Inline attributes
@@ -127,9 +127,6 @@ class NotusAttribute<T> implements NotusAttributeBuilder<T> {
127127
// ignore: const_eval_throws_exception
128128
static const embed = EmbedAttributeBuilder._();
129129

130-
/// Container attribute
131-
static const container = const ContainerAttributeBuilder._();
132-
133130
static NotusAttribute _fromKeyValue(String key, dynamic value) {
134131
if (!_registry.containsKey(key)) {
135132
throw ArgumentError.value(
@@ -337,6 +334,7 @@ class _ItalicAttribute extends NotusAttribute<bool> {
337334
/// [NotusAttribute.link] instead.
338335
class LinkAttributeBuilder extends NotusAttributeBuilder<String> {
339336
static const _kLink = 'a';
337+
340338
const LinkAttributeBuilder._() : super._(_kLink, NotusAttributeScope.inline);
341339

342340
/// Creates a link attribute with specified link [value].
@@ -350,6 +348,7 @@ class LinkAttributeBuilder extends NotusAttributeBuilder<String> {
350348
/// [NotusAttribute.heading] instead.
351349
class HeadingAttributeBuilder extends NotusAttributeBuilder<int> {
352350
static const _kHeading = 'heading';
351+
353352
const HeadingAttributeBuilder._()
354353
: super._(_kHeading, NotusAttributeScope.line);
355354

@@ -369,6 +368,7 @@ class HeadingAttributeBuilder extends NotusAttributeBuilder<int> {
369368
/// [NotusAttribute.block] instead.
370369
class BlockAttributeBuilder extends NotusAttributeBuilder<String> {
371370
static const _kBlock = 'block';
371+
372372
const BlockAttributeBuilder._() : super._(_kBlock, NotusAttributeScope.line);
373373

374374
/// Formats a block of lines as a bullet list.
@@ -458,49 +458,3 @@ class EmbedAttribute extends NotusAttribute<Map<String, dynamic>> {
458458
return hashObjects(objects);
459459
}
460460
}
461-
462-
class ContainerAttributeBuilder
463-
extends NotusAttributeBuilder<Map<String, dynamic>> {
464-
const ContainerAttributeBuilder._()
465-
: super._(ContainerAttribute._kContainer, NotusAttributeScope.inline);
466-
467-
@override
468-
NotusAttribute<Map<String, dynamic>> get unset => ContainerAttribute._(null);
469-
470-
NotusAttribute<Map<String, dynamic>> withValue(Map<String, dynamic> value) =>
471-
ContainerAttribute._(value);
472-
}
473-
474-
class ContainerAttribute extends NotusAttribute<Map<String, dynamic>> {
475-
static const _kValueEquality = const MapEquality<String, dynamic>();
476-
static const _kContainer = 'container';
477-
478-
ContainerAttribute._(Map<String, dynamic> value)
479-
: super._(_kContainer, NotusAttributeScope.inline, value);
480-
481-
@override
482-
NotusAttribute<Map<String, dynamic>> get unset => ContainerAttribute._(null);
483-
484-
@override
485-
bool operator ==(other) {
486-
if (identical(this, other)) return true;
487-
if (other is! ContainerAttribute) return false;
488-
ContainerAttribute typedOther = other;
489-
return key == typedOther.key &&
490-
scope == typedOther.scope &&
491-
_kValueEquality.equals(value, typedOther.value);
492-
}
493-
494-
@override
495-
int get hashCode {
496-
final objects = [key, scope];
497-
if (value != null) {
498-
final valueHashes =
499-
value.entries.map((entry) => hash2(entry.key, entry.value));
500-
objects.addAll(valueHashes);
501-
} else {
502-
objects.add(value);
503-
}
504-
return hashObjects(objects);
505-
}
506-
}

0 commit comments

Comments
 (0)