@@ -150,32 +150,52 @@ function handleNode(
150150 return ;
151151 }
152152
153+ let tokenizedTarget : Widget = null ;
154+
155+ // flags handler
156+ if ( ! tokenizedTarget ) {
157+ if (
158+ ! config . disable_flags_support &&
159+ config . should_ignore_flag ?.( node ) !== true
160+ ) {
161+ try {
162+ tokenizedTarget = flags_handling_gate ( node ) ;
163+ } catch ( e ) {
164+ console . error ( "error while interpreting flags.. skipping" , e ) ;
165+ }
166+ }
167+ }
168+
153169 // -------------------------------------------------------------------------
154170 // --------------------------- Detected tokens -----------------------------
155171 // -------------------------------------------------------------------------
156172
157173 // - image - // image detection is always enabled exceptionally.
158174 // TODO: separate image detection with static logic based and the smart one.
159- const _detect_if_image = detectIf . image ( node ) ;
160- if ( _detect_if_image . result ) {
161- return tokenizeGraphics . fromImage ( node , _detect_if_image . data ) ;
175+ if ( ! tokenizedTarget ) {
176+ const _detect_if_image = detectIf . image ( node ) ;
177+ if ( _detect_if_image . result ) {
178+ return tokenizeGraphics . fromImage ( node , _detect_if_image . data ) ;
179+ }
162180 }
163181
164- if ( config . disable_detection ) {
165- // skip detection
166- } else {
167- // - icon -
168- const _detect_if_icon = detectIf . icon ( node ) ;
169- if ( _detect_if_icon . result ) {
170- return tokenizeGraphics . fromIcon ( node , _detect_if_icon . data ) ;
171- }
182+ if ( ! tokenizedTarget ) {
183+ if ( config . disable_detection ) {
184+ // skip detection
185+ } else {
186+ // - icon -
187+ const _detect_if_icon = detectIf . icon ( node ) ;
188+ if ( _detect_if_icon . result ) {
189+ return tokenizeGraphics . fromIcon ( node , _detect_if_icon . data ) ;
190+ }
172191
173- // - button -
174- // TODO: this causes confliction with flags
175- // const _detect_if_button = detectIf.button(node);
176- // if (_detect_if_button.result) {
177- // return tokenizeButton.fromManifest(node, _detect_if_button.data);
178- // }
192+ // - button -
193+ // TODO: this causes confliction with flags
194+ // const _detect_if_button = detectIf.button(node);
195+ // if (_detect_if_button.result) {
196+ // return tokenizeButton.fromManifest(node, _detect_if_button.data);
197+ // }
198+ }
179199 }
180200 // -------------------------------------------------------------------------
181201 // --------------------------- Detected tokens -----------------------------
@@ -190,7 +210,7 @@ function handleNode(
190210 // -------------------------------------------------------------------------
191211 // --------------------------- Pre processors ------------------------------
192212 // -------------------------------------------------------------------------
193- let tokenizedTarget : Widget = null ;
213+
194214 // masking handler
195215 if ( containsMasking ( node ) ) {
196216 tokenizedTarget = tokenizeMasking . fromMultichild (
@@ -199,19 +219,6 @@ function handleNode(
199219 ) ;
200220 }
201221
202- // flags handler
203- if ( ! tokenizedTarget ) {
204- if (
205- ! config . disable_flags_support &&
206- config . should_ignore_flag ?.( node ) !== true
207- ) {
208- try {
209- tokenizedTarget = flags_handling_gate ( node ) ;
210- } catch ( e ) {
211- console . error ( "error while interpreting flags.. skipping" , e ) ;
212- }
213- }
214- }
215222 //
216223 // -------------------------------------------------------------------------
217224 //
0 commit comments